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; }
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; }
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; }
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); }
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)); } }
public void validateRelocation(String uuid, SVNURL url, SVNURL rootUrl) throws SVNException { String urlUuid = null; SVNURL urlRoot = null; for (String uu : collectedUuids.keySet()) { SVNURL root = collectedUuids.get(uu); if (SVNURLUtil.getRelativeURL(root, url, false) != null) { urlUuid = uu; urlRoot = root; break; } } if (urlUuid == null) { SVNRepository repository = getRepositoryAccess().createRepository(url, null); urlUuid = repository.getRepositoryUUID(true); urlRoot = repository.getRepositoryRoot(true); } if (rootUrl != null && !rootUrl.equals(urlRoot)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_INVALID_RELOCATION, "''{0}'' is not the root of the repository", url); SVNErrorManager.error(err, SVNLogType.WC); } if (uuid != null && !uuid.equals(urlUuid)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_INVALID_RELOCATION, "The repository at ''{0}'' has uuid ''{1}'', but the WC has ''{2}''", url, urlUuid, uuid); SVNErrorManager.error(err, SVNLogType.WC); } }
@Override protected Map<SVNURL, SVNMergeRangeList> run(SVNWCContext context) throws SVNException { SVNURL[] root = new SVNURL[1]; Map<String, Map<String, SVNMergeRangeList>> catalog = SvnNgMergeinfoUtil.getMergeInfo(getWcContext(), getRepositoryAccess(), getOperation().getFirstTarget(), false, false, root); Map<String, SVNMergeRangeList> mergeinfo = null; if (catalog != null) { String relativePath; if (getOperation().getFirstTarget().isURL()) { relativePath = SVNURLUtil.getRelativeURL(root[0], getOperation().getFirstTarget().getURL(), false); } else { relativePath = SVNFileUtil.getFilePath(getWcContext().getNodeReposRelPath(getFirstTarget())); } mergeinfo = catalog.get(relativePath); } if (mergeinfo != null) { Map<SVNURL, SVNMergeRangeList> result = new TreeMap<SVNURL, SVNMergeRangeList>(new Comparator<SVNURL>() { public int compare(SVNURL o1, SVNURL o2) { return o1.toString().compareTo(o2.toString()); } }); for (String path : mergeinfo.keySet()) { SVNURL fullURL = root[0].appendPath(path, false); result.put(fullURL, mergeinfo.get(path)); } return result; } return null; }
@Override public void setRepositoryInfo(SVNURL root, Map repositoryLocks) { super.setRepositoryInfo(root, repositoryLocks); if (myAnchorStatus.getRepositoryRootURL() == null) { myAnchorStatus.setRepositoryRootURL(myRepositoryRoot); } if (myAnchorStatus.getURL() != null && myAnchorStatus.getRepositoryRootURL() != null) { myAnchorStatus.setRepositoryRelativePath(SVNURLUtil.getRelativeURL(myAnchorStatus.getRepositoryRootURL(), myAnchorStatus.getURL(), false)); } }
status.setRepositoryRelativePath(SVNURLUtil.getRelativeURL(myRepositoryRoot, status.getRemoteURL(), false));
public static ISVNUpdateEditor createEditor(SVNWCContext context, File localAbsPath, File wriAbsPath, SVNURL url, SVNURL reposRootUrl, String reposUuid, Map<String, SVNProperties> iprops, boolean useCommitTimes, String[] preservedExts, File recordAncestorAbsPath, SVNURL recordedUrl, SVNRevision recordedPegRev, SVNRevision recordedRev) { SvnExternalUpdateEditor editor = new SvnExternalUpdateEditor(); editor.context = context; editor.localAbsPath = localAbsPath; editor.wriAbsPath = wriAbsPath != null ? wriAbsPath : SVNFileUtil.getParentFile(localAbsPath); editor.url = url; editor.reposRootUrl = reposRootUrl; editor.reposUuid = reposUuid; editor.name = SVNFileUtil.getFileName(localAbsPath); editor.useCommitTimes = useCommitTimes; editor.extPatterns = preservedExts; editor.recordAncestorAbspath = recordAncestorAbsPath; editor.recordedReposRelPath = SVNFileUtil.createFilePath(SVNURLUtil.getRelativeURL(reposRootUrl, recordedUrl, false)); editor.recordedPegRevision = recordedPegRev != null ? recordedPegRev.getNumber() : SVNWCContext.INVALID_REVNUM; editor.recordedRevision = recordedRev != null ? recordedRev.getNumber() : SVNWCContext.INVALID_REVNUM; editor.iprops = iprops; return (ISVNUpdateEditor) SVNCancellableEditor.newInstance(editor, context.getEventHandler(), null); }
final String relativeURL = SVNURLUtil.getRelativeURL(info.getRepositoryRootURL(), info.getURL(), true); buffer.append("Relative URL: ^/" + relativeURL + "\n");
File sourceReposRelPath = new File(SVNURLUtil.getRelativeURL(wcReposRoot, url2, false)); File targetReposRelPath = context.getNodeReposRelPath(mergeTarget);
String unresolvedURL = externals[k].getUnresolvedUrl(); if (unresolvedURL != null && !SVNPathUtil.isURL(unresolvedURL) && unresolvedURL.startsWith("../")) { unresolvedURL = SVNURLUtil.getRelativeURL(repos.getRepositoryRoot(true), resolvedURL, true); if (unresolvedURL.startsWith("/")) { unresolvedURL = "^" + unresolvedURL;
final String relativeURL = SVNURLUtil.getRelativeURL(info.getRepositoryRootURL(), info.getURL(), true); buffer = openCDataTag("relative-url", "^/" + relativeURL, buffer);
@Override public void close() throws Exception { final SVNRepository repo = openSvnRepository(url); long revision = repo.getLatestRevision(); try { final SVNLock[] locks = repo.getLocks(suffix); if (locks.length > 0) { final SVNURL root = repo.getRepositoryRoot(true); final Map<String, String> locksMap = new HashMap<>(); for (SVNLock lock : locks) { final String relativePath = SVNURLUtil.getRelativeURL(url, root.appendPath(lock.getPath(), false), false); locksMap.put(relativePath, lock.getID()); } repo.unlock(locksMap, true, null); } final ISVNEditor editor = repo.getCommitEditor("Remove subdir for test", null, false, null); editor.openRoot(-1); editor.deleteEntry(suffix, revision); editor.closeEdit(); } finally { repo.closeSession(); } }
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 (copyFromUrl != null) { SVNWCNodeReposInfo reposInfo = getContext().getNodeReposInfo(parentPath); File reposRelPath = new File(SVNURLUtil.getRelativeURL(reposInfo.reposRootUrl, copyFromUrl, false)); getContext().getDb().opCopyDir(path, new SVNProperties(), copyFromRev, new SVNDate(0, 0), null, if (copyFromUrl != null) { SVNWCNodeReposInfo reposInfo = getContext().getNodeReposInfo(parentPath); File reposRelPath = new File(SVNURLUtil.getRelativeURL(reposInfo.reposRootUrl, copyFromUrl, false)); getContext().getDb().opCopyDir(path, new SVNProperties(), copyFromRev, new SVNDate(0, 0), null,
String reposPath = SVNURLUtil.getRelativeURL(originalURL, copyFromURL, false); if (reposPath.startsWith("/")) { reposPath = reposPath.substring("/".length());
String relativePath = SVNURLUtil.getRelativeURL(topSrcUrl, pair.source, false); relativePath = SVNEncodingUtil.uriDecode(relativePath); SVNNodeKind sourceKind = repository.checkPath(relativePath, pair.revNum);
String localReposUuid = localReposInfo.reposUuid; String externalRepositoryPath = SVNURLUtil.getRelativeURL(repositoryRoot, newUrl, false);