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); } }
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); }
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(); }
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);
if (!SVNURLUtil.isAncestor(reposInfo.reposRootUrl, copyFromURL)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Copyfrom-url ''{0}'' has different repository root than ''{0}''",
SVNURL repositoryRootUrl = nodeRepositoryInfo.reposRootUrl; if (nodeRepositoryInfo != null && repositoryRootUrl != null) { if (!SVNURLUtil.isAncestor(repositoryRootUrl, url)) {