private void copyBranch(final JGitPathImpl source, final JGitPathImpl target) { checkCondition("source and taget should have same setup", !hasSameFileSystem(source, target)); if (existsBranch(target)) { throw new FileAlreadyExistsException(target.toString()); } if (!existsBranch(source)) { throw new NoSuchFileException(target.toString()); } createBranch(source, target); }
private void copyBranch(final JGitPathImpl source, final JGitPathImpl target) { checkCondition("source and target should have same file system", hasSameFileSystem(source, target)); if (existsBranch(target)) { throw new FileAlreadyExistsException(target.toString()); } if (!existsBranch(source)) { throw new NoSuchFileException(target.toString()); } createBranch(source, target); }
private void moveBranch(final JGitPathImpl source, final JGitPathImpl target, final CopyOption... options) { checkCondition("source and target should have same file system", hasSameFileSystem(source, target)); if (!exists(source)) { throw new NoSuchFileException(target.toString()); } boolean targetExists = existsBranch(target); if (targetExists && !contains(options, StandardCopyOption.REPLACE_EXISTING)) { throw new FileAlreadyExistsException(target.toString()); } if (!targetExists) { createBranch(source, target); deleteBranch(source); } else { commit(target, buildCommitInfo("reverting from {" + source.getPath() + "}", Arrays.asList(options)), new RevertCommitContent(source.getRefTree())); } }