public static void copySymlink(File source, File target) throws SVNException { if (source.equals(target)) { return; } SVNFileUtil.createSymlink(target, SVNFileUtil.getSymlinkName(source)); }
public void write(Object writeBaton, String s) throws SVNException { if (!s.startsWith("link ")) { SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.IO_WRITE_ERROR, "Invalid link representation"); SVNErrorManager.error(errorMessage, SVNLogType.WC); } s = s.substring("link ".length()); File targetAbsPath = (File) writeBaton; if (SVNFileType.getType(targetAbsPath) == SVNFileType.FILE) { SVNFileUtil.deleteFile(targetAbsPath); } SVNFileUtil.createSymlink(targetAbsPath, s); }
public static boolean createSymlink(File link, File linkName) throws SVNException { if (isWindows) { return false; } if (SVNFileType.getType(link) != SVNFileType.NONE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Cannot create symbolic link ''{0}''; file already exists", link); SVNErrorManager.error(err); } String linkTarget = ""; try { linkTarget = readSingleLine(linkName); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getLocalizedMessage()); SVNErrorManager.error(err, e); } if (linkTarget.startsWith("link")) { linkTarget = linkTarget.substring("link".length()).trim(); } return createSymlink(link, linkTarget); }
createSymlink(dst, name);
public static boolean createSymlink(File link, File linkName) throws SVNException { if (!symlinksSupported()) { return false; } if (SVNFileType.getType(link) != SVNFileType.NONE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Cannot create symbolic link ''{0}''; file already exists", link); SVNErrorManager.error(err, Level.FINE, SVNLogType.WC); } String fileContents = ""; try { fileContents = readSingleLine(linkName); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getMessage()); SVNErrorManager.error(err, e, Level.FINE, SVNLogType.DEFAULT); } if (fileContents.startsWith("link ")) { fileContents = fileContents.substring("link".length()).trim(); return createSymlink(link, fileContents); } // create file using internal representation createFile(link, fileContents, "UTF-8"); return true; }
public static void copy(File src, File dst, boolean safe, boolean copyAdminDirectories) throws SVNException { SVNFileType srcType = SVNFileType.getType(src); if (srcType == SVNFileType.FILE) { copyFile(src, dst, safe); } else if (srcType == SVNFileType.DIRECTORY) { copyDirectory(src, dst, copyAdminDirectories, null); } else if (srcType == SVNFileType.SYMLINK) { String name = SVNFileUtil.getSymlinkName(src); if (name != null) { SVNFileUtil.createSymlink(dst, name); } } }
String name = getSymlinkName(file); if (name != null) { createSymlink(dst, name);
public static void copy(File src, File dst, boolean safe, boolean copyAdminDirectories) throws SVNException { SVNFileType srcType = SVNFileType.getType(src); if (srcType == SVNFileType.FILE) { copyFile(src, dst, safe); } else if (srcType == SVNFileType.DIRECTORY) { copyDirectory(src, dst, copyAdminDirectories, null); } else if (srcType == SVNFileType.SYMLINK) { String name = SVNFileUtil.getSymlinkName(src); if (name != null) { SVNFileUtil.createSymlink(dst, name); } } }
public static void copy(File src, File dst, boolean safe, boolean copyAdminDirectories) throws SVNException { SVNFileType srcType = SVNFileType.getType(src); if (srcType == SVNFileType.FILE) { copyFile(src, dst, safe); } else if (srcType == SVNFileType.DIRECTORY) { copyDirectory(src, dst, copyAdminDirectories, null); } else if (srcType == SVNFileType.SYMLINK) { String name = SVNFileUtil.getSymlinkName(src); if (name != null) { SVNFileUtil.createSymlink(dst, name); } } }
public static boolean createSymlink(File link, File linkName) throws SVNException { if (!symlinksSupported()) { return false; } if (SVNFileType.getType(link) != SVNFileType.NONE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Cannot create symbolic link ''{0}''; file already exists", link); SVNErrorManager.error(err, Level.FINE, SVNLogType.WC); } String fileContents = ""; try { fileContents = readSingleLine(linkName); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getMessage()); SVNErrorManager.error(err, e, Level.FINE, SVNLogType.DEFAULT); } if (fileContents.startsWith("link ")) { fileContents = fileContents.substring("link".length()).trim(); return createSymlink(link, fileContents); } //create file using internal representation createFile(link, fileContents, "UTF-8"); return true; }
public static boolean createSymlink(File link, File linkName) throws SVNException { if (!symlinksSupported()) { return false; } if (SVNFileType.getType(link) != SVNFileType.NONE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Cannot create symbolic link ''{0}''; file already exists", link); SVNErrorManager.error(err, Level.FINE, SVNLogType.WC); } String fileContents = ""; try { fileContents = readSingleLine(linkName); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getMessage()); SVNErrorManager.error(err, e, Level.FINE, SVNLogType.DEFAULT); } if (fileContents.startsWith("link ")) { fileContents = fileContents.substring("link".length()).trim(); return createSymlink(link, fileContents); } //create file using internal representation createFile(link, fileContents, "UTF-8"); return true; }
public static void copy(File src, File dst, boolean safe, boolean copyAdminDirectories) throws SVNException { SVNFileType srcType = SVNFileType.getType(src); if (srcType == SVNFileType.FILE) { copyFile(src, dst, safe); } else if (srcType == SVNFileType.DIRECTORY) { copyDirectory(src, dst, copyAdminDirectories, null); } else if (srcType == SVNFileType.SYMLINK) { String name = SVNFileUtil.getSymlinkName(src); if (name != null) { SVNFileUtil.createSymlink(dst, name); } } }
private void copyAddedFileAdm(File src, SVNWCAccess srcAccess, SVNWCAccess dstAccess, File dstParent, String dstName, boolean isAdded) throws SVNException { File dst = new File(dstParent, dstName); SVNFileType srcType = SVNFileType.getType(src); if (srcType == SVNFileType.SYMLINK) { String linkName = SVNFileUtil.getSymlinkName(src); SVNFileUtil.createSymlink(dst, linkName); } else { SVNFileUtil.copyFile(src, dst, false); } if (isAdded) { SVNWCManager.add(dst, dstAccess.getAdminArea(dstParent), null, SVNRepository.INVALID_REVISION, SVNDepth.INFINITY); copyProps(src, dst, srcAccess, dstAccess); } }
private void copyAddedFileAdm(File src, SVNWCAccess srcAccess, SVNWCAccess dstAccess, File dstParent, String dstName, boolean isAdded) throws SVNException { File dst = new File(dstParent, dstName); SVNFileType srcType = SVNFileType.getType(src); if (srcType == SVNFileType.SYMLINK) { String linkName = SVNFileUtil.getSymlinkName(src); SVNFileUtil.createSymlink(dst, linkName); } else { SVNFileUtil.copyFile(src, dst, false); } if (isAdded) { SVNWCManager.add(dst, dstAccess.getAdminArea(dstParent), null, SVNRepository.INVALID_REVISION, SVNDepth.INFINITY); copyProps(src, dst, srcAccess, dstAccess); } }
String name = getSymlinkName(file); if (name != null) { createSymlink(dst, name);
} else if (expand) { SVNFileUtil.createSymlink(dst, src); } else { SVNFileUtil.detranslateSymlink(src, dst);
public void runOperation(SVNWCContext ctx, File wcRootAbspath, SVNSkel workItem) throws SVNException { File srcRelPath = new File(workItem.getChild(1).getValue()); File dstRelPath = new File(workItem.getChild(2).getValue()); File srcAbspath = !SVNFileUtil.isAbsolute(srcRelPath) ? SVNFileUtil.createFilePath(wcRootAbspath, srcRelPath) : srcRelPath; File dstAbspath = !SVNFileUtil.isAbsolute(dstRelPath) ? SVNFileUtil.createFilePath(wcRootAbspath, dstRelPath) : dstRelPath; SVNFileType srcType = SVNFileType.getType(srcAbspath); if (srcType == SVNFileType.DIRECTORY) { SVNFileUtil.moveDir(srcAbspath, dstAbspath); } else if (srcType == SVNFileType.FILE) { SVNFileUtil.moveFile(srcAbspath, dstAbspath); } else if (srcType == SVNFileType.SYMLINK) { SVNFileUtil.createSymlink(dstAbspath, SVNFileUtil.getSymlinkName(srcAbspath)); } } }
} else if (expand) { SVNFileUtil.createSymlink(dst, src); } else { SVNFileUtil.detranslateSymlink(src, dst);
} else if (expand) { SVNFileUtil.createSymlink(dst, src); } else { SVNFileUtil.detranslateSymlink(src, dst);