public void setLocation(SVNURL url, boolean forceReconnect) throws SVNException { super.setLocation(url, forceReconnect); }
public void setLocation(SVNURL url, boolean forceReconnect) throws SVNException { // attempt to use reparent. if (reparent(url)) { super.setLocation(url, false); return; } super.setLocation(url, true); myRealm = null; }
private SVNRepository getRepository(SVNURL url) throws SVNException { if (url == null) { return null; } if (myRepository == null) { myRepository = createRepository(url, null, null, false); } else { myRepository.setLocation(url, false); } return myRepository; }
public void reparent(String url) throws ClientException { try { svnRepository.setLocation(SVNURL.parseURIEncoded(url), false); } catch (SVNException e) { throw ClientException.fromException(e); } }
protected Object[] calculateRemainingRangeList(File targetFile, SVNEntry entry, SVNURL sourceRoot, boolean[] indirect, SVNURL url1, long revision1, SVNURL url2, long revision2, SVNMergeRange range) throws SVNException { if (skipExtendedMerge() || myCurrentRemainingRanges == null) { return super.calculateRemainingRangeList(targetFile, entry, sourceRoot, indirect, url1, revision1, url2, revision2, range); } // targetMergeInfo and implicitMergeInfo should be processed anyway. Map targetMergeInfo = null; Map implicitMergeInfo = null; if (isHonorMergeInfo()) { myRepository1.setLocation(entry.getSVNURL(), false); Map[] fullMergeInfo = getFullMergeInfo(entry, indirect, SVNMergeInfoInheritance.INHERITED, myRepository1, targetFile, Math.max(revision1, revision2), Math.min(revision1, revision2)); targetMergeInfo = fullMergeInfo[0]; implicitMergeInfo = fullMergeInfo[1]; myRepository1.setLocation(url1, false); } return new Object[]{myCurrentRemainingRanges, targetMergeInfo, implicitMergeInfo}; }
protected SVNURL ensureSessionURL(SVNRepository repository, SVNURL url) throws SVNException { SVNURL oldURL = repository.getLocation(); if (url == null) { url = repository.getRepositoryRoot(true); } if (!url.equals(oldURL)) { repository.setLocation(url, false); return oldURL; } return null; }
protected static SVNURL ensureSessionURL(SVNRepository repository, SVNURL url) throws SVNException { SVNURL oldURL = repository.getLocation(); if (url == null) { url = repository.getRepositoryRoot(true); } if (!url.equals(oldURL)) { repository.setLocation(url, false); return oldURL; } return oldURL; }
protected SVNURL ensureSessionURL(SVNRepository repository, SVNURL url) throws SVNException { SVNURL oldURL = repository.getLocation(); if (url == null) { url = repository.getRepositoryRoot(true); } if (!url.equals(oldURL)) { repository.setLocation(url, false); return oldURL; } return null; }
protected SVNURL ensureSessionURL(SVNRepository repository, SVNURL url) throws SVNException { SVNURL oldURL = repository.getLocation(); if (url == null) { url = repository.getRepositoryRoot(true); } if (!url.equals(oldURL)) { repository.setLocation(url, false); return oldURL; } return null; }
private Collection<SVNURL> findMissingParents(SVNURL targetURL, SVNRepository repository) throws SVNException { SVNNodeKind kind = repository.checkPath("", -1); Collection<SVNURL> parents = new ArrayList<SVNURL>(); while (kind == SVNNodeKind.NONE) { parents.add(targetURL); targetURL = targetURL.removePathTail(); repository.setLocation(targetURL, false); kind = repository.checkPath("", -1); } if (kind != SVNNodeKind.DIR) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ALREADY_EXISTS, "Path ''{0}'' already exists, but it is not a directory", targetURL); SVNErrorManager.error(err, SVNLogType.WC); } return parents; }
private void checkDiffTargetExists(SVNURL url, long revision, long otherRevision, SVNRepository repository) throws SVNException { repository.setLocation(url, false); SVNNodeKind kind = repository.checkPath("", revision); if (kind == SVNNodeKind.NONE) { if (revision == otherRevision) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND, "Diff target ''{0}'' was not found in the " + "repository at revision ''{1}''", new Object[]{ url, new Long(revision) }); SVNErrorManager.error(err, SVNLogType.WC); } else { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND, "Diff target ''{0}'' was not found in the " + "repository at revisions ''{1}'' and ''{2}''", new Object[]{ url, new Long(revision), new Long(otherRevision) }); SVNErrorManager.error(err, SVNLogType.WC); } } }
protected void doAdditionalMerge() throws SVNException { SVNURL oldURL1 = myRepository1.getLocation(); SVNURL oldURL2 = myRepository2.getLocation(); BufferedReader reader = createReader(); try { SVNMergeTask nextTask = readTask(reader); while (nextTask != null) { runMergeTask(nextTask, myRevision1, myRevision2); nextTask = readTask(reader); } } finally { SVNFileUtil.closeFile(reader); myRepository1.setLocation(oldURL1, false); myRepository2.setLocation(oldURL2, false); myRepository = null; } }
private void checkDiffTargetExists(SVNURL url, long revision, long otherRevision, SVNRepository repository) throws SVNException { SVNURL sessionUrl = repository.getLocation(); boolean equal = sessionUrl.equals(url); if (!equal) { repository.setLocation(url, true); } SVNNodeKind kind = repository.checkPath("", revision); if (kind == SVNNodeKind.NONE) { if (revision == otherRevision) { SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND, "Diff target ''{0}'' was not found in the repository at revision ''{1}''", url, revision); SVNErrorManager.error(errorMessage, SVNLogType.WC); } else { SVNErrorMessage errorMessage = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND, "Diff target ''{0}'' was not found in the repository at revision ''{1}'' or ''{2}''", url, revision, otherRevision); SVNErrorManager.error(errorMessage, SVNLogType.WC); } } if (!equal) { repository.setLocation(url, true); } }
public Map<String, SVNDirEntry> fetchEntries(SVNURL reposRoot, File path) throws SVNException { SVNURL url = SVNWCUtils.join(reposRoot, path); if (repos2[0] == null) { repos2[0] = getRepositoryAccess().createRepository(url, null, false); } else { repos2[0].setLocation(url, false); } final Map<String, SVNDirEntry> entries = new HashMap<String, SVNDirEntry>(); if (repos2[0].checkPath("", revNumber) == SVNNodeKind.DIR) { repos2[0].getDir("", revNumber, null, new ISVNDirEntryHandler() { public void handleDirEntry(SVNDirEntry dirEntry) throws SVNException { if (dirEntry.getName() != null && !"".equals(dirEntry.getName())) { entries.put(dirEntry.getName(), dirEntry); } } }); return entries; } return null; } };
public Map<String, SVNDirEntry> fetchEntries(SVNURL reposRoot, File path) throws SVNException { SVNURL url = SVNWCUtils.join(reposRoot, path); if (repos2[0] == null) { repos2[0] = getRepositoryAccess().createRepository(url, null, false); } else { repos2[0].setLocation(url, false); } final Map<String, SVNDirEntry> entries = new HashMap<String, SVNDirEntry>(); SVNNodeKind kind = repos2[0].checkPath("", revnum); if (kind == SVNNodeKind.DIR) { repos2[0].getDir("", revnum, null, new ISVNDirEntryHandler() { public void handleDirEntry(SVNDirEntry dirEntry) throws SVNException { if (dirEntry.getName() != null && !"".equals(dirEntry.getName())) { entries.put(dirEntry.getName(), dirEntry); } } }); } return entries; } };
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); } };
private SVNURL reposLocations(SVNURL url, long pegRevision, SVNURL reposRootUrl, String reposUuid, long opRevision, SVNRepository svnRepository) throws SVNException { SVNURL oldUrl = SvnNgMergeDriver.ensureSessionURL(svnRepository, url); try { Structure<SvnRepositoryAccess.LocationsInfo> locations = repositoryAccess.getLocations(svnRepository, SvnTarget.fromURL(url), SVNRevision.create(pegRevision), SVNRevision.create(opRevision), SVNRevision.HEAD); SVNURL startUrl = locations.get(SvnRepositoryAccess.LocationsInfo.startUrl); return startUrl; } finally { svnRepository.setLocation(oldUrl, false); } }
protected Map getMergeInfo(SVNURL url, SVNRevision pegRevision, SVNURL repositoryRoot[]) throws SVNException { SVNRepository repository = null; try { repository = createRepository(url, null, null, true); long revisionNum = getRevisionNumber(pegRevision, repository, null); SVNURL reposRoot = repository.getRepositoryRoot(true); if (repositoryRoot != null && repositoryRoot.length > 0) { repositoryRoot[0] = reposRoot; } String relPath = getPathRelativeToSession(url, null, repository); if (relPath == null) { repository.setLocation(url, false); relPath = ""; } return getReposMergeInfo(repository, relPath, revisionNum, SVNMergeInfoInheritance.INHERITED, false); } finally { if (repository != null) { repository.closeSession(); } } }
private SingleFileMergeData singleFileMergeGetFile(SVNRepository repository, SVNURL url, long revision, File wcTarget) throws SVNException { SingleFileMergeData result = new SingleFileMergeData(); result.file = SVNFileUtil.createUniqueFile(context.getDb().getWCRootTempDir(wcTarget), "merge", "", false); SVNURL oldUrl = ensureSessionURL(repository, url); OutputStream outputStream = null; try { outputStream = SVNFileUtil.openFileForWriting(result.file); result.properties = new SVNProperties(); repository.getFile("", revision, result.properties, outputStream); return result; } finally { SVNFileUtil.closeFile(outputStream); if (oldUrl != null) { repository.setLocation(oldUrl, false); } } }
private void listExternalItems(SVNRepository repository, SVNExternal[] externalItems, SVNURL externalParentUrl, SVNDepth depth, int entryFields, boolean fetchLocks, ISVNDirEntryHandler handler) throws SVNException { SVNURL rootUrl = repository.getRepositoryRoot(true); for (SVNExternal externalItem : externalItems) { SVNURL resolvedURL = externalItem.resolveURL(rootUrl, externalParentUrl); try { //TODO: peg revision repository.setLocation(resolvedURL, true); doList(repository, externalItem.getRevision().getNumber(), handler, fetchLocks, depth, entryFields, externalParentUrl, externalItem.getPath()); } catch (SVNException e) { if (e.getErrorMessage().getErrorCode() != SVNErrorCode.CANCELLED) { if (getOperation().getEventHandler() != null) { SVNEvent event = SVNEventFactory.createSVNEvent(new File(externalItem.getPath()), SVNNodeKind.UNKNOWN, null, -1, SVNEventAction.FAILED_EXTERNAL, SVNEventAction.FAILED_EXTERNAL, e.getErrorMessage(), null); getOperation().getEventHandler().handleEvent(event, UNKNOWN); } } else { throw e; } } } } }