}
private Map getMergeInfoForPath(FSRevisionRoot revRoot, String path, SVNMergeInfoInheritance inherit) throws SVNException {
Map mergeInfo = null;
path = SVNPathUtil.canonicalizeAbsolutePath(path);
FSParentPath parentPath = revRoot.openPath(path, true, true);
if (inherit == SVNMergeInfoInheritance.NEAREST_ANCESTOR && parentPath.getParent() == null) {
return mergeInfo;
}
FSParentPath nearestAncestor = null;
if (inherit == SVNMergeInfoInheritance.NEAREST_ANCESTOR) {
nearestAncestor = parentPath.getParent();
} else {
nearestAncestor = parentPath;
}
FSFS fsfs = revRoot.getOwner();
while (true) {
boolean hasMergeInfo = nearestAncestor.getRevNode().hasMergeInfo();
if (hasMergeInfo) {
break;
}
if (inherit == SVNMergeInfoInheritance.EXPLICIT) {
return mergeInfo;
}
nearestAncestor = nearestAncestor.getParent();
if (nearestAncestor == null) {
return mergeInfo;
}
}
SVNProperties propList = nearestAncestor.getRevNode().getProperties(fsfs);
String mergeInfoString = propList.getStringValue(SVNProperty.MERGE_INFO);
if (mergeInfoString == null) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT,
"Node-revision ''{0}@{1}'' claims to have mergeinfo but doesn''t",
new Object[] { nearestAncestor.getAbsPath(), new Long(revRoot.getRevision()) });
SVNErrorManager.error(err, SVNLogType.FSFS);
}
if (nearestAncestor == parentPath) {
return SVNMergeInfoUtil.parseMergeInfo(new StringBuffer(mergeInfoString), null);