}
private void doDiffURLWC(File path1, SVNRevision revision1, SVNRevision pegRevision, File path2,
SVNRevision revision2, boolean reverse, SVNDepth depth, boolean useAncestry, OutputStream result,
Collection changeLists) throws SVNException {
SVNWCAccess wcAccess = createWCAccess();
try {
int admDepth = getAdminDepth(depth);
SVNAdminAreaInfo info = wcAccess.openAnchor(path2, false, admDepth);
File anchorPath = info.getAnchor().getRoot();
String target = "".equals(info.getTargetName()) ? null : info.getTargetName();
SVNEntry anchorEntry = info.getAnchor().getVersionedEntry("", false);
if (anchorEntry.getURL() == null) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ENTRY_MISSING_URL, "''{0}'' has no URL", anchorPath);
SVNErrorManager.error(err, SVNLogType.WC);
}
SVNURL url1;
SVNURL anchorURL = anchorEntry.getSVNURL();
if (pegRevision.isValid()) {
SVNRepositoryLocation[] locations = getLocations(null, path1, null, pegRevision, revision1, SVNRevision.UNDEFINED);
url1 = locations[0].getURL();
String anchorPath2 = SVNPathUtil.append(anchorURL.toString(), target == null ? "" : target);
if (!reverse) {
getDiffGenerator().init(url1.toString(), anchorPath2);
} else {
getDiffGenerator().init(anchorPath2, url1.toString());
}
} else {
url1 = getURL(path1);
}
SVNRepository repository = createRepository(anchorURL, null, null, true);
long revNumber = getRevisionNumber(revision1, repository, path1);
AbstractDiffCallback callback = new SVNDiffCallback(info.getAnchor(),
getDiffGenerator(),
reverse ? -1 : revNumber, reverse ? revNumber : -1, result);
SVNDiffEditor editor = new SVNDiffEditor(wcAccess, info, callback, useAncestry, reverse /* reverse */,
revision2 == SVNRevision.BASE || revision2 == SVNRevision.COMMITTED /* compare to base */,
depth, changeLists);
ISVNEditor filterEditor = SVNAmbientDepthFilterEditor.wrap(editor, info, false);
boolean serverSupportsDepth = repository.hasCapability(SVNCapability.DEPTH);
SVNReporter reporter = new SVNReporter(info, info.getAnchor().getFile(info.getTargetName()),
false, !serverSupportsDepth, depth, false, false, true, getDebugLog());
// this should be rev2.
long pegRevisionNumber = getRevisionNumber(revision2, repository, path2);
try {
repository.diff(url1, revNumber, pegRevisionNumber, target, !useAncestry, depth, true, reporter, SVNCancellableEditor.newInstance(filterEditor, this, getDebugLog()));
} finally {
editor.cleanup();
}
} finally {
wcAccess.close();
}
}