public void closeDir() throws SVNException { myCurrentDirectory = myCurrentDirectory.getParentFile(); myCurrentPath = SVNPathUtil.removeTail(myCurrentPath); }
private String combinePathPrefixes(String pathPrefix1, String pathPrefix2) { if (pathPrefix1 == null) { return pathPrefix2; } if (pathPrefix2 == null) { return pathPrefix1; } return SVNPathUtil.getCommonPathAncestor(pathPrefix1, pathPrefix2); }
public static Map<String, SVNMergeRangeList> adjustMergeInfoSourcePaths(Map<String, SVNMergeRangeList> mergeInfo, String walkPath, Map<String, SVNMergeRangeList> wcMergeInfo) { mergeInfo = mergeInfo == null ? new TreeMap<String, SVNMergeRangeList>() : mergeInfo; for (Iterator<String> paths = wcMergeInfo.keySet().iterator(); paths.hasNext();) { String srcMergePath = paths.next(); SVNMergeRangeList rangeList = (SVNMergeRangeList) wcMergeInfo.get(srcMergePath); mergeInfo.put(SVNPathUtil.getAbsolutePath(SVNPathUtil.append(srcMergePath, walkPath)), rangeList); } return mergeInfo; }
public static File getCommonFileAncestor(File file1, File file2) { String path1 = file1.getAbsolutePath(); String path2 = file2.getAbsolutePath(); path1 = validateFilePath(path1); path2 = validateFilePath(path2); String commonPath = getCommonPathAncestor(path1, path2); if (commonPath != null) { return new File(commonPath); } return null; }
private String mapToReposRelPath(String pathOrUrl) { if (SVNPathUtil.isURL(pathOrUrl)) { return SVNPathUtil.getPathAsChild(SVNEncodingUtil.uriDecode(pathOrUrl), repositoryRoot.toDecodedString()); } else { return SVNPathUtil.append(baseRelPath, pathOrUrl.startsWith("/") ? pathOrUrl.substring("/".length()) : pathOrUrl); } }
private Object relPathSkipJoin() throws SVNException { String movedTo = getColumnString(SVNWCDbSchema.NODES__Fields.moved_to); if (movedTo == null) { return null; } String originalParentPath = String.valueOf(getBind(2)); String movedParentPath = String.valueOf(getBind(3)); String relativeMovedTo = SVNPathUtil.getRelativePath(originalParentPath, movedTo); String movedMovedTo = SVNPathUtil.append(movedParentPath, relativeMovedTo); return movedMovedTo; }
public void deleteEntry(String path, long revision) throws SVNException { File localAbspath = getLocalAbspath(path); String name = SVNPathUtil.tail(path); Entry pb = currentEntry; if (pb.deletes == null) { pb.deletes = new HashSet<String>(); } pb.deletes.add(name); }
public void openDir(String path, long revision) throws SVNException { DirectoryInfo parent = myCurrentDirInfo; String cmpPath = null; long cmpRev = -1; if (parent != null && parent.myComparePath != null && SVNRevision.isValidRevisionNumber(parent.myCompareRevision)) { cmpPath = SVNPathUtil.append(parent.myComparePath, SVNPathUtil.tail(path)); cmpRev = parent.myCompareRevision; } myCurrentDirInfo = createDirectoryInfo(path, cmpPath, cmpRev, parent); }
public long fetchFile(String path, long revision, OutputStream os, SVNProperties properties) throws SVNException { SVNURL url = reposRoot.appendPath(SVNPathUtil.removeTail(path), false); if (repos2[0] == null) { repos2[0] = createRepository(url, null, null, false); } else { repos2[0].setLocation(url, false); } return repos2[0].getFile(SVNPathUtil.tail(path), revision, properties, os); } };
public boolean isURL() { return SVNPathUtil.isURL(myTarget); }
private String getPath(File path) { return SVNPathUtil.getRelativePath(myTarget.getAbsolutePath(), path.getAbsolutePath()); }
private static String ensureAbsolutePath(String path) { if (path != null) { path = SVNPathUtil.canonicalizePath(path); } if (path != null && (path.length() == 0 || path.charAt(0) != '/')) { return "/" + path; } return path; }
private void migrateNodeProps(File dirAbsPath, SVNWCDbUpgradeData data, String name, int originalFormat, SVNAdminArea area) throws SVNException { String dirAbsPathString = SVNFileUtil.getFilePath(dirAbsPath); String oldWcRootAbsPath = SVNPathUtil.getCommonPathAncestor(dirAbsPathString, SVNFileUtil.getFilePath(data.rootAbsPath)); File dirRelPath = new File(SVNPathUtil.getRelativePath(oldWcRootAbsPath, dirAbsPathString)); File basePropsFile = area.getBasePropertiesFile(name, false); File revertPropsFile = area.getRevertPropertiesFile(name, false); File propsFile = area.getPropertiesFile(name, false); SVNProperties baseProps = basePropsFile.isFile() ? new SVNWCProperties(basePropsFile, null).asMap() : null; SVNProperties revertProps = revertPropsFile.isFile() ? new SVNWCProperties(revertPropsFile, null).asMap() : null; SVNProperties props = propsFile.isFile() ? new SVNWCProperties(propsFile, null).asMap() : null; SvnWcDbProperties.upgradeApplyProperties(data.root, data.rootAbsPath, SVNFileUtil.createFilePath(dirRelPath, name), baseProps, props, revertProps, originalFormat); } }
private void inheritImplicitMergeinfoFromParent(MergePath parent, MergePath child, long revision1, long revision2, SVNRepository repository) throws SVNException { if (parent.implicitMergeInfo == null) { Map[] mergeinfo = getFullMergeInfo(false, true, null, SVNMergeInfoInheritance.INHERITED, repository, parent.absPath, Math.max(revision1, revision2), Math.min(revision1, revision2)); parent.implicitMergeInfo = mergeinfo[1]; } child.implicitMergeInfo = new TreeMap<String, SVNMergeRangeList>(); String ancestorPath = SVNPathUtil.getCommonPathAncestor(parent.absPath.getAbsolutePath().replace(File.separatorChar, '/'), child.absPath.getAbsolutePath().replace(File.separatorChar, '/')); String childPath = SVNPathUtil.getPathAsChild(ancestorPath, child.absPath.getAbsolutePath().replace(File.separatorChar, '/')); if (childPath.startsWith("/")) { childPath = childPath.substring(1); } SVNMergeInfoUtil.adjustMergeInfoSourcePaths(child.implicitMergeInfo, childPath, parent.implicitMergeInfo); }
public static File skipAncestor(File parent, File child) { String parentPath = SVNFileUtil.getFilePath(parent); String childPath = SVNFileUtil.getFilePath(child); if (SVNPathUtil.isAncestor(parentPath, childPath)) { return SVNFileUtil.createFilePath(SVNPathUtil.getRelativePath(parentPath, childPath)); } return null; }
public static String formatCertificatePath(String path) { path = new File(path).getAbsolutePath(); path = SVNPathUtil.validateFilePath(path); if (SVNFileUtil.isWindows && path.length() >= 3 && path.charAt(1) == ':' && path.charAt(2) == '/' && Character.isLowerCase(path.charAt(0))) { path = Character.toUpperCase(path.charAt(0)) + path.substring(1); } return path; } }
public static Map<String, SVNMergeRangeList> appendSuffix(Map<String, SVNMergeRangeList> mergeinfo, String suffix) { Map<String, SVNMergeRangeList> result = new TreeMap<String, SVNMergeRangeList>(); for (String path : mergeinfo.keySet()) { String pathWithSuffix = SVNPathUtil.append(path, suffix); result.put(pathWithSuffix, mergeinfo.get(path)); } return result; }
private SVNConflictVersion[] makeConflictVersions(File victimAbsPath, SVNNodeKind nodeKind, SVNURL rootUrl, SvnNgMergeDriver.MergeSource mergeSource, File targetAbsPath) { File child = SVNFileUtil.skipAncestor(targetAbsPath, victimAbsPath); assert child != null; String leftPath = SVNPathUtil.getRelativePath(rootUrl.toDecodedString(), mergeSource.url1.toDecodedString()); String rightPath = SVNPathUtil.getRelativePath(rootUrl.toDecodedString(), mergeSource.url2.toDecodedString()); SVNConflictVersion[] svnConflictVersions = new SVNConflictVersion[2]; svnConflictVersions[0] = new SVNConflictVersion(rootUrl, SVNPathUtil.append(leftPath, SVNFileUtil.getFilePath(child)), mergeSource.rev1, nodeKind); svnConflictVersions[1] = new SVNConflictVersion(rootUrl, SVNPathUtil.append(rightPath, SVNFileUtil.getFilePath(child)), mergeSource.rev2, nodeKind); return svnConflictVersions; }
public void addFile(String path, String copyFromPath, long copyFromRevision) throws SVNException { String name = SVNPathUtil.tail(path); currentFile = createFileInfo(currentDirectory, path, true); currentDirectory.comparedEntries.add(name); }
public void openFile(String path, long revision) throws SVNException { String cmpPath = null; long cmpRev = -1; if (myCurrentDirInfo != null && myCurrentDirInfo.myComparePath != null && SVNRevision.isValidRevisionNumber(myCurrentDirInfo.myCompareRevision)) { cmpPath = SVNPathUtil.append(myCurrentDirInfo.myComparePath, SVNPathUtil.tail(path)); cmpRev = myCurrentDirInfo.myCompareRevision; } dumpNode(path, SVNNodeKind.FILE, SVNAdminHelper.NODE_ACTION_CHANGE, false, cmpPath, cmpRev); }