repository = null;
}
} else if (entry.getURL() != null){
url = entry.getSVNURL();
} else {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ENTRY_MISSING_URL,
"''{0}'' has no URL", path);
SVNErrorManager.error(err, SVNLogType.WC);
}
} finally {
wcAccess.close();
}
}
String repoPath = "";
Map locations = null;
SVNURL rootURL = null;
if (repository == null) {
repository = createRepository(url, null, null, true);
} else {
// path relative to repository location.
repoPath = SVNPathUtil.getPathAsChild(repository.getLocation().toString(), url.toString());
if (repoPath == null) {
repoPath = "";
}
}
if (pegRevisionNumber < 0) {
pegRevisionNumber = getRevisionNumber(revision, youngestRevNumber, repository, path);
}
if (revision == start && revision == SVNRevision.HEAD) {
startRevisionNumber = pegRevisionNumber;
} else {
startRevisionNumber = getRevisionNumber(start, youngestRevNumber, repository, path);
}
if (!end.isValid()) {
endRevisionNumber = startRevisionNumber;
} else {
endRevisionNumber = getRevisionNumber(end, youngestRevNumber, repository, path);
}
if (endRevisionNumber == pegRevisionNumber && startRevisionNumber == pegRevisionNumber) {
SVNRepositoryLocation[] result = new SVNRepositoryLocation[2];
result[0] = new SVNRepositoryLocation(url, startRevisionNumber);
result[1] = new SVNRepositoryLocation(url, endRevisionNumber);
return result;
}
rootURL = repository.getRepositoryRoot(true);
long[] revisionsRange = startRevisionNumber == endRevisionNumber ? new long[] { startRevisionNumber } :
new long[] {startRevisionNumber, endRevisionNumber};
try {
locations = repository.getLocations(repoPath, (Map) null, pegRevisionNumber, revisionsRange);
} catch (SVNException e) {
if (e.getErrorMessage() != null && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_IMPLEMENTED) {
locations = getLocations10(repository, pegRevisionNumber, startRevisionNumber, endRevisionNumber);
} else {
throw e;
}
}
// try to get locations with 'log' method.
SVNLocationEntry startPath = (SVNLocationEntry) locations.get(new Long(startRevisionNumber));
SVNLocationEntry endPath = (SVNLocationEntry) locations.get(new Long(endRevisionNumber));
if (startPath == null) {
Object source = path != null ? (Object) path : (Object) url;
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_UNRELATED_RESOURCES, "Unable to find repository location for ''{0}'' in revision ''{1}''", new Object[] {source, new Long(startRevisionNumber)});
SVNErrorManager.error(err, SVNLogType.WC);
}
if (endPath == null) {
Object source = path != null ? (Object) path : (Object) url;
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_UNRELATED_RESOURCES, "The location for ''{0}'' for revision {1} does not exist in the " +
"repository or refers to an unrelated object", new Object[] {source, new Long(endRevisionNumber)});
SVNErrorManager.error(err, SVNLogType.WC);
}
SVNRepositoryLocation[] result = new SVNRepositoryLocation[2];