}
private SVNLogEntryPath getFileCopyOrigin(String path) throws SVNException {
Object[] paths = myCopiedPaths.keySet().toArray();
Arrays.sort(paths, 0, paths.length, SVNPathUtil.PATH_COMPARATOR);
SVNLogEntryPath realPath = null;
List candidates = new ArrayList();
for (int i = 0; i < paths.length; i++) {
String copiedPath = (String) paths[i];
if (!path.startsWith(copiedPath + "/")) {
continue;
} else if (path.equals(copiedPath)) {
return (SVNLogEntryPath) myCopiedPaths.get(copiedPath);
}
candidates.add(copiedPath);
}
// check candidates from the end of the list
for(int i = candidates.size() - 1; i >=0; i--) {
String candidateParent = (String) candidates.get(i);
if (getSourceRepository().checkPath(candidateParent, myTargetRevision) != SVNNodeKind.DIR) {
continue;
}
SVNLogEntryPath changedPath = (SVNLogEntryPath) myCopiedPaths.get(candidateParent);
String fileRelativePath = path.substring(candidateParent.length() + 1);
fileRelativePath = SVNPathUtil.append(changedPath.getCopyPath(), fileRelativePath);
return new SVNLogEntryPath(path, ' ', fileRelativePath, changedPath.getCopyRevision());
}
return realPath;
}