private String combinePathPrefixes(String pathPrefix1, String pathPrefix2) { if (pathPrefix1 == null) { return pathPrefix2; } if (pathPrefix2 == null) { return pathPrefix1; } return SVNPathUtil.getCommonPathAncestor(pathPrefix1, pathPrefix2); }
private File getCommonCopyDst(Collection<SvnCopyPair> copyPairs) { String ancestor = null; for (SvnCopyPair svnCopyPair : copyPairs) { String path = svnCopyPair.dst.getAbsolutePath().replace(File.separatorChar, '/'); if (ancestor == null) { ancestor = path; continue; } ancestor = SVNPathUtil.getCommonPathAncestor(ancestor, path); } return new File(ancestor); }
private File getCommonCopyAncestor(Collection<SvnCopyPair> copyPairs) { File ancestor = null; for (SvnCopyPair svnCopyPair : copyPairs) { if (ancestor == null) { ancestor = svnCopyPair.source; continue; } String ancestorPath = ancestor.getAbsolutePath().replace(File.separatorChar, '/'); String sourcePath = svnCopyPair.source.getAbsolutePath().replace(File.separatorChar, '/'); ancestorPath = SVNPathUtil.getCommonPathAncestor(ancestorPath, sourcePath); ancestor = new File(ancestorPath); } return ancestor; }
private static String getCommonAncestor(String p1, String p2) { if (SVNFileUtil.isWindows || SVNFileUtil.isOpenVMS) { String ancestor = SVNPathUtil.getCommonPathAncestor(p1.toLowerCase(), p2.toLowerCase()); if (equals(ancestor, p1)) { return p1; } else if (equals(ancestor, p2)) { return p2; } else if (startsWith(p1, ancestor)) { return p1.substring(0, ancestor.length()); } return ancestor; } return SVNPathUtil.getCommonPathAncestor(p1, p2); }
private static String getCommonAncestor(String p1, String p2) { if (SVNFileUtil.isWindows || SVNFileUtil.isOpenVMS) { String ancestor = SVNPathUtil.getCommonPathAncestor(p1.toLowerCase(), p2.toLowerCase()); if (equals(ancestor, p1)) { return p1; } else if (equals(ancestor, p2)) { return p2; } else if (startsWith(p1, ancestor)) { return p1.substring(0, ancestor.length()); } return ancestor; } return SVNPathUtil.getCommonPathAncestor(p1, p2); }
private static String getCommonAncestor(String p1, String p2) { if (SVNFileUtil.isWindows || SVNFileUtil.isOpenVMS) { String ancestor = SVNPathUtil.getCommonPathAncestor(p1.toLowerCase(), p2.toLowerCase()); if (equals(ancestor, p1)) { return p1; } else if (equals(ancestor, p2)) { return p2; } else if (startsWith(p1, ancestor)) { return p1.substring(0, ancestor.length()); } return ancestor; } return SVNPathUtil.getCommonPathAncestor(p1, p2); }
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 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 static String getCommonAncestor(String p1, String p2) { if (SVNFileUtil.isWindows || SVNFileUtil.isOpenVMS) { String ancestor = SVNPathUtil.getCommonPathAncestor(p1.toLowerCase(), p2.toLowerCase()); if (equals(ancestor, p1)) { return p1; } else if (equals(ancestor, p2)) { return p2; } else if (startsWith(p1, ancestor)) { return p1.substring(0, ancestor.length()); } return ancestor; } return SVNPathUtil.getCommonPathAncestor(p1, p2); }
private static String getCommonAncestor(String p1, String p2) { if (SVNFileUtil.isWindows || SVNFileUtil.isOpenVMS) { String ancestor = SVNPathUtil.getCommonPathAncestor(p1.toLowerCase(), p2.toLowerCase()); if (equals(ancestor, p1)) { return p1; } else if (equals(ancestor, p2)) { return p2; } else if (startsWith(p1, ancestor)) { return p1.substring(0, ancestor.length()); } return ancestor; } return SVNPathUtil.getCommonPathAncestor(p1, p2); }
public static String getCommonURLAncestor(String url1, String url2) { // skip protocol and host, if they are different -> return ""; if (url1 == null || url2 == null) { return null; } int index = 0; StringBuffer protocol = new StringBuffer(); while (index < url1.length() && index < url2.length()) { char ch1 = url1.charAt(index); if (ch1 != url2.charAt(index)) { return ""; } if (ch1 == ':') { break; } protocol.append(ch1); index++; } index += 3; // skip :// protocol.append("://"); if (index >= url1.length() || index >= url2.length()) { return ""; } protocol.append(getCommonPathAncestor(url1.substring(index), url2 .substring(index))); return protocol.toString(); }
private void inheritImplicitMergeinfoFromParent(MergePath parent, MergePath child, long revision1, long revision2, SVNRepository repository) throws SVNException { if (parent.myImplicitMergeInfo == null) { SVNEntry entry = myWCAccess.getEntry(parent.myPath, false); Map[] mergeinfo = getFullMergeInfo(entry, false, true, null, SVNMergeInfoInheritance.INHERITED, repository, parent.myPath, Math.max(revision1, revision2), Math.min(revision1, revision2)); parent.myImplicitMergeInfo = mergeinfo[1]; } child.myImplicitMergeInfo = new TreeMap(); String ancestorPath = SVNPathUtil.getCommonPathAncestor(parent.myPath.getAbsolutePath().replace(File.separatorChar, '/'), child.myPath.getAbsolutePath().replace(File.separatorChar, '/')); String childPath = SVNPathUtil.getPathAsChild(ancestorPath, child.myPath.getAbsolutePath().replace(File.separatorChar, '/')); if (childPath.startsWith("/")) { childPath = childPath.substring(1); } SVNMergeInfoUtil.adjustMergeInfoSourcePaths(child.myImplicitMergeInfo, childPath, parent.myImplicitMergeInfo); }
dstParentPath = SVNPathUtil.removeTail(pair.myDst); dstParentPath = SVNPathUtil.getCommonPathAncestor(dstParentPath, dstPath);
String oldWcRootAbsPath = SVNPathUtil.getCommonPathAncestor( dirAbsPathString, SVNFileUtil.getFilePath(data.rootAbsPath)); File dirRelPath = new File(SVNPathUtil.getRelativePath(
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); } }
public static SVNURL getCommonURLAncestor(SVNURL url1, SVNURL url2) { // skip protocol and host, if they are different -> return null; if (url1 == null || url2 == null) { return null; } if (!url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort()) { return null; } if (url1.getUserInfo() != null) { if (!url1.getUserInfo().equals(url2.getUserInfo())) { return null; } } else { if (url2.getUserInfo() != null) { return null; } } String path1 = url1.getPath(); String path2 = url2.getPath(); String commonPath = SVNPathUtil.getCommonPathAncestor(path1, path2); try { return url1.setPath(commonPath, false); } catch (SVNException e) { } return null; }
public static SVNURL getCommonURLAncestor(SVNURL url1, SVNURL url2) { // skip protocol and host, if they are different -> return null; if (url1 == null || url2 == null) { return null; } if (!url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort()) { return null; } if (url1.getUserInfo() != null) { if (!url1.getUserInfo().equals(url2.getUserInfo())) { return null; } } else { if (url2.getUserInfo() != null) { return null; } } String path1 = url1.getPath(); String path2 = url2.getPath(); String commonPath = SVNPathUtil.getCommonPathAncestor(path1, path2); try { return url1.setPath(commonPath, false); } catch (SVNException e) { } return null; }
public static SVNURL getCommonURLAncestor(SVNURL url1, SVNURL url2) { // skip protocol and host, if they are different -> return null; if (url1 == null || url2 == null) { return null; } if (!url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort()) { return null; } if (url1.getUserInfo() != null) { if (!url1.getUserInfo().equals(url2.getUserInfo())) { return null; } } else { if (url2.getUserInfo() != null) { return null; } } String path1 = url1.getPath(); String path2 = url2.getPath(); String commonPath = SVNPathUtil.getCommonPathAncestor(path1, path2); try { return url1.setPath(commonPath, false); } catch (SVNException e) { } return null; }
public static SVNURL getCommonURLAncestor(SVNURL url1, SVNURL url2) { // skip protocol and host, if they are different -> return null; if (url1 == null || url2 == null) { return null; } if (!url1.getProtocol().equals(url2.getProtocol()) || !url1.getHost().equals(url2.getHost()) || url1.getPort() != url2.getPort()) { return null; } if (url1.getUserInfo() != null) { if (!url1.getUserInfo().equals(url2.getUserInfo())) { return null; } } else { if (url1.getUserInfo() != url2.getUserInfo()) { return null; } } String path1 = url1.getPath(); String path2 = url2.getPath(); String commonPath = SVNPathUtil.getCommonPathAncestor(path1, path2); try { return url1.setPath(commonPath, false); } catch (SVNException e) { } return null; }
public void transaction(SVNSqlJetDb db) throws SqlJetException, SVNException { requiredRelPath = localRelPath; SVNSqlJetStatement stmt = db.getStatement(SVNWCDbStatements.SELECT_MOVED_OUTSIDE); try { stmt.bindf("isi", wcRoot.getWcId(), localRelPath, 0); boolean haveRow = stmt.next(); while (haveRow) { File moveDstRelPath = SVNFileUtil.createFilePath(stmt.getColumnString(NODES__Fields.moved_to)); requiredRelPath = SVNFileUtil.createFilePath(SVNPathUtil.getCommonPathAncestor(SVNFileUtil.getFilePath(requiredRelPath), SVNFileUtil.getFilePath(moveDstRelPath))); haveRow = stmt.next(); } } finally { stmt.reset(); } } }