public static SvnCommitPacket harvestCopyCommitables(SVNWCContext context, File path, SVNURL dst, SvnCommitPacket packet, ISvnUrlKindCallback urlKindCallback, ISvnCommitParameters commitParameters, Map<File, String> externalsStorage) throws SVNException { SVNWCNodeReposInfo reposInfo = context.getNodeReposInfo(path); File commitRelPath = new File(SVNURLUtil.getRelativeURL(reposInfo.reposRootUrl, dst, false)); harvestCommittables(context, path, packet, null, reposInfo.reposRootUrl, commitRelPath, true, SVNDepth.INFINITY, false, null, null, false, false, urlKindCallback, commitParameters, externalsStorage, context.getEventHandler()); return packet; }
SVNURL topURL = SVNURLUtil.condenceURLs(urls, paths, false); if (paths.isEmpty()) { paths.add("");
private SVNURL getCommonCopyAncestor(Collection<SvnCopyPair> copyPairs) { SVNURL ancestor = null; for (SvnCopyPair svnCopyPair : copyPairs) { if (ancestor == null) { ancestor = svnCopyPair.source; continue; } ancestor = SVNURLUtil.getCommonURLAncestor(ancestor, svnCopyPair.source); } return ancestor; }
SVNURL topDstUrl = firstPair.dst.removePathTail(); for (SvnCopyPair pair : copyPairs) { topDstUrl = SVNURLUtil.getCommonURLAncestor(topDstUrl, pair.dst); String path = SVNURLUtil.getRelativeURL(repository.getLocation(), pair.dst, false); if (repository.checkPath(path, -1) != SVNNodeKind.NONE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ALREADY_EXISTS, if (parents != null) { for (SVNURL parent : parents) { String parentPath = SVNURLUtil.getRelativeURL(repositoryRoot, parent, false); packet.addItem(null, SVNNodeKind.DIR, repositoryRoot, parentPath, -1, null, -1, null, SvnCommitItem.ADD);
if (!SVNURLUtil.isAncestor(reposInfo.reposRootUrl, copyFromURL)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Copyfrom-url ''{0}'' has different repository root than ''{0}''", String reposPath = SVNURLUtil.getRelativeURL(originalURL, copyFromURL, false); if (reposPath.startsWith("/")) { reposPath = reposPath.substring("/".length());
public static Map<String, String> translateLockTokens(Map<SVNURL, String> lockTokens, SVNURL baseURL) { Map<String, String> translatedLocks = new TreeMap<String, String>(); for (Iterator<SVNURL> urls = lockTokens.keySet().iterator(); urls.hasNext();) { SVNURL url = urls.next(); if (!SVNURLUtil.isAncestor(baseURL, url)) { continue; } String token = lockTokens.get(url); String path = url.getPath().substring(baseURL.getPath().length()); if (path.startsWith("/")) { path = path.substring(1); } translatedLocks.put(path, token); } return translatedLocks; } }
private void checkReposMatch(File path, SVNURL url) throws SVNException { if (!SVNURLUtil.isAncestor(getReposRootURL(), url)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Url ''{0}'' of ''{1}'' is not in repository ''{2}''", url, path, getReposRootURL()); SVNErrorManager.error(err, SVNLogType.WC); } }
protected SVNTreeConflictDescription makeTreeConflict(File victim, SVNNodeKind kind, SVNConflictAction action, SVNConflictReason reason) throws SVNException { SVNURL srcReposRoot = myRepository1.getRepositoryRoot(true); String child = SVNPathUtil.getRelativePath(myTarget.getAbsolutePath(), victim.getAbsolutePath()); SVNURL leftURL = null; SVNURL rightURL = null; if (child != null) { leftURL = myCurrentMergeSource.myURL1.appendPath(child, false); rightURL = myCurrentMergeSource.myURL2.appendPath(child, false); } else { leftURL = myCurrentMergeSource.myURL1; rightURL = myCurrentMergeSource.myURL2; } SVNConflictVersion leftConflictVersion = new SVNConflictVersion(srcReposRoot, SVNURLUtil.getRelativeURL(srcReposRoot, leftURL, false), myCurrentMergeSource.myRevision1, kind); SVNConflictVersion rightConflictVersion = new SVNConflictVersion(srcReposRoot, SVNURLUtil.getRelativeURL(srcReposRoot, rightURL, false), myCurrentMergeSource.myRevision2, kind); SVNTreeConflictDescription conflictDescription = new SVNTreeConflictDescription(victim, kind, action, reason, SVNOperation.MERGE, leftConflictVersion, rightConflictVersion); return conflictDescription; }
SVNURL topURL = SVNURLUtil.condenceURLs(urls, paths, false); if (paths.isEmpty()) { paths.add("");
rootURL = getCommonURLAncestor(rootURL, urls[i]); continue; SVNURL common = getCommonURLAncestor(url1, url2); if (common == null) { continue;
private void ensureReposInfo(SVNEntry entry, File localAbsPath, RepositoryInfo lastRepositoryInfo, Map<SVNURL, String> reposCache) throws SVNException { if (getEntryRepositoryRootURL(entry) != null && entry.getUUID() != null) { return; } if ((getEntryRepositoryRootURL(entry) == null || entry.getUUID() == null) && getEntryURL(entry) != null) { for (Iterator<SVNURL> items = reposCache.keySet().iterator(); items.hasNext();) { SVNURL reposRootUrl = items.next(); if (SVNURLUtil.isAncestor(reposRootUrl, getEntryURL(entry))) { if (getEntryRepositoryRootURL(entry) == null) { entry.setRepositoryRootURL(reposRootUrl); } if (entry.getUUID() == null) { entry.setUUID((String) reposCache.get(reposRootUrl)); } return; } } } if (getEntryURL(entry) == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_UNSUPPORTED_FORMAT, "Working copy ''{0}'' can't be upgraded because it doesn't have a url", localAbsPath); SVNErrorManager.error(err, SVNLogType.WC); } fetchReposInfo(entry, lastRepositoryInfo); }
protected SVNTreeConflictDescription makeTreeConflict(File victim, SVNNodeKind kind, SVNConflictAction action, SVNConflictReason reason) throws SVNException { SVNURL srcReposRoot = myRepository1.getRepositoryRoot(true); String child = SVNPathUtil.getRelativePath(myTarget.getAbsolutePath(), victim.getAbsolutePath()); SVNURL leftURL = null; SVNURL rightURL = null; if (child != null) { leftURL = myCurrentMergeSource.myURL1.appendPath(child, false); rightURL = myCurrentMergeSource.myURL2.appendPath(child, false); } else { leftURL = myCurrentMergeSource.myURL1; rightURL = myCurrentMergeSource.myURL2; } SVNConflictVersion leftConflictVersion = new SVNConflictVersion(srcReposRoot, SVNURLUtil.getRelativeURL(srcReposRoot, leftURL), myCurrentMergeSource.myRevision1, kind); SVNConflictVersion rightConflictVersion = new SVNConflictVersion(srcReposRoot, SVNURLUtil.getRelativeURL(srcReposRoot, rightURL), myCurrentMergeSource.myRevision2, kind); SVNTreeConflictDescription conflictDescription = new SVNTreeConflictDescription(victim, kind, action, reason, SVNOperation.MERGE, leftConflictVersion, rightConflictVersion); return conflictDescription; }
SVNURL topURL = SVNURLUtil.condenceURLs(urls, paths, false); if (paths.isEmpty()) { paths.add("");
rootURL = getCommonURLAncestor(rootURL, urls[i]); continue; SVNURL common = getCommonURLAncestor(url1, url2); if (common == null) { continue;
private void fetchReposInfo(SVNEntry entry, RepositoryInfo lastRepositoryInfo) throws SVNException { /* The same info is likely to retrieved multiple times (e.g. externals) */ if (lastRepositoryInfo.repositoryRootUrl != null && SVNURLUtil.isAncestor(lastRepositoryInfo.repositoryRootUrl, getEntryURL(entry))) { entry.setRepositoryRootURL(lastRepositoryInfo.repositoryRootUrl); entry.setUUID(lastRepositoryInfo.UUID); return; } SvnRepositoryAccess repAccess = new SvnOldRepositoryAccess(getOperation()); SVNRepository repository = repAccess.createRepository(getEntryURL(entry), null, true); entry.setRepositoryRootURL(repository.getRepositoryRoot(true)); entry.setUUID(repository.getRepositoryUUID(true)); lastRepositoryInfo.repositoryRootUrl = getEntryRepositoryRootURL(entry); lastRepositoryInfo.UUID = entry.getUUID(); }
protected void recordTreeConflict(File victim, SVNAdminArea adminArea, SVNNodeKind kind, SVNConflictAction action, SVNConflictReason reason) throws SVNException { if (myIsRecordOnly || myIsDryRun) { return; } SVNURL srcReposRoot = myRepository1.getRepositoryRoot(true); String child = SVNPathUtil.getRelativePath(myTarget.getAbsolutePath(), victim.getAbsolutePath()); SVNURL leftURL = null; SVNURL rightURL = null; if (child != null) { leftURL = myCurrentMergeSource.myURL1.appendPath(child, false); rightURL = myCurrentMergeSource.myURL2.appendPath(child, false); } else { leftURL = myCurrentMergeSource.myURL1; rightURL = myCurrentMergeSource.myURL2; } SVNConflictVersion leftConflictVersion = new SVNConflictVersion(srcReposRoot, SVNURLUtil.getRelativeURL(srcReposRoot, leftURL), myCurrentMergeSource.myRevision1, kind); SVNConflictVersion rightConflictVersion = new SVNConflictVersion(srcReposRoot, SVNURLUtil.getRelativeURL(srcReposRoot, rightURL), myCurrentMergeSource.myRevision2, kind); SVNTreeConflictDescription conflictDescription = new SVNTreeConflictDescription(victim, kind, action, reason, SVNOperation.MERGE, leftConflictVersion, rightConflictVersion); adminArea.addTreeConflict(conflictDescription); }
SVNURL topURL = SVNURLUtil.condenceURLs(urls, paths, false); if (paths.isEmpty()) { paths.add("");
rootURL = getCommonURLAncestor(rootURL, urls[i]); continue; SVNURL common = getCommonURLAncestor(url1, url2); if (common == null) { continue;
if (switchURL != null && !SVNURLUtil.isAncestor(repositoryInfo.rootUrl, switchURL)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_INVALID_SWITCH, "''{0}'' is not the same repository as ''{1}''", switchURL, repositoryInfo.rootUrl); SVNErrorManager.error(err, SVNLogType.WC);
private void tweakStatusHash(FileInfo fileInfo, File path, SVNStatusType text, SVNStatusType props, SVNLock lock) throws SVNException { Map hash = fileInfo.myParent.myChildrenStatuses; SVNStatus status = (SVNStatus) hash.get(fileInfo.myPath); if (status == null) { if (text != SVNStatusType.STATUS_ADDED) { return; } status = createStatus(path); hash.put(fileInfo.myPath, status); } if (text == SVNStatusType.STATUS_ADDED && status.getRemoteContentsStatus() == SVNStatusType.STATUS_DELETED) { text = SVNStatusType.STATUS_REPLACED; } status.setRemoteStatus(fileInfo.myURL, text, props, lock, fileInfo.myRemoteKind, fileInfo.myRemoteRevision, fileInfo.myRemoteDate, fileInfo.myRemoteAuthor); status.setRepositoryRootURL(myRepositoryRoot); if (status.getRemoteURL() != null) { status.setRepositoryRelativePath(SVNURLUtil.getRelativeURL(myRepositoryRoot, status.getRemoteURL(), false)); } }