private void deleteResource(final JGitPathImpl path, final DeleteOption... options) { delete(path, buildCommitInfo("delete {" + path.getPath() + "}", Arrays.asList(options))); }
private void moveFiles(final JGitPathImpl source, final JGitPathImpl target, final Map<JGitPathImpl, JGitPathImpl> fromTo, final CopyOption... options) { final Map<String, String> result = new HashMap<>(fromTo.size()); for (final Map.Entry<JGitPathImpl, JGitPathImpl> fromToEntry : fromTo.entrySet()) { result.put(PathUtil.normalize(fromToEntry.getKey().getPath()), PathUtil.normalize(fromToEntry.getValue().getPath())); } commit(source, buildCommitInfo("moving from {" + source.getPath() + "} to {" + target.getPath() + "}", Arrays.asList(options)), new MoveCommitContent(result)); }
private void copyFiles(final JGitPathImpl source, final JGitPathImpl target, final Map<JGitPathImpl, JGitPathImpl> sourceDest, final CopyOption... options) { final Map<String, String> result = new HashMap<>(sourceDest.size()); for (final Map.Entry<JGitPathImpl, JGitPathImpl> sourceDestEntry : sourceDest.entrySet()) { result.put(PathUtil.normalize(sourceDestEntry.getKey().getPath()), PathUtil.normalize(sourceDestEntry.getValue().getPath())); } commit(source, buildCommitInfo("copy from {" + source.getPath() + "} to {" + target.getPath() + "}", Arrays.asList(options)), new CopyCommitContent(result)); }
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())); } }