}
Map sourceEntries = source.getDirEntries(myFSFS);
Map targetEntries = target.getDirEntries(myFSFS);
Map ancestorEntries = ancestor.getDirEntries(myFSFS);
Set removedEntries = new SVNHashSet();
for (Iterator ancestorEntryNames = ancestorEntries.keySet().iterator(); ancestorEntryNames.hasNext();) {
String ancestorEntryName = (String) ancestorEntryNames.next();
FSEntry ancestorEntry = (FSEntry) ancestorEntries.get(ancestorEntryName);
FSEntry sourceEntry = removedEntries.contains(ancestorEntryName) ? null : (FSEntry) sourceEntries.get(ancestorEntryName);
FSEntry targetEntry = (FSEntry) targetEntries.get(ancestorEntryName);
if (sourceEntry != null && ancestorEntry.getId().equals(sourceEntry.getId())) {
/*
* No changes were made to this entry while the transaction was
* in progress, so do nothing to the target.
*/
} else if (targetEntry != null && ancestorEntry.getId().equals(targetEntry.getId())) {
if (myFSFS.supportsMergeInfo()) {
FSRevisionNode targetEntryNode = myFSFS.getRevisionNode(targetEntry.getId());
long mergeInfoStart = targetEntryNode.getMergeInfoCount();
mergeInfoIncrement -= mergeInfoStart;
}
if (sourceEntry != null) {
if (myFSFS.supportsMergeInfo()) {
FSRevisionNode sourceEntryNode = myFSFS.getRevisionNode(sourceEntry.getId());
long mergeInfoEnd = sourceEntryNode.getMergeInfoCount();
mergeInfoIncrement += mergeInfoEnd;
}
myTxnRoot.setEntry(target, ancestorEntryName, sourceEntry.getId(), sourceEntry.getType());
} else {
myTxnRoot.deleteEntry(target, ancestorEntryName);
}
} else {
if (sourceEntry == null || targetEntry == null) {
SVNErrorManager.error(FSErrors.errorConflict(SVNPathUtil.getAbsolutePath(SVNPathUtil.append(targetPath, ancestorEntryName))), SVNLogType.FSFS);
}
if (sourceEntry.getType() == SVNNodeKind.FILE || targetEntry.getType() == SVNNodeKind.FILE || ancestorEntry.getType() == SVNNodeKind.FILE) {
SVNErrorManager.error(FSErrors.errorConflict(SVNPathUtil.getAbsolutePath(SVNPathUtil.append(targetPath, ancestorEntryName))), SVNLogType.FSFS);
}
if (!sourceEntry.getId().getNodeID().equals(ancestorEntry.getId().getNodeID()) ||
!sourceEntry.getId().getCopyID().equals(ancestorEntry.getId().getCopyID()) ||
!targetEntry.getId().getNodeID().equals(ancestorEntry.getId().getNodeID()) ||
!targetEntry.getId().getCopyID().equals(ancestorEntry.getId().getCopyID())) {
SVNErrorManager.error(FSErrors.errorConflict(SVNPathUtil.getAbsolutePath(SVNPathUtil.append(targetPath, ancestorEntryName))), SVNLogType.FSFS);
}
FSRevisionNode sourceEntryNode = myFSFS.getRevisionNode(sourceEntry.getId());
FSRevisionNode targetEntryNode = myFSFS.getRevisionNode(targetEntry.getId());
FSRevisionNode ancestorEntryNode = myFSFS.getRevisionNode(ancestorEntry.getId());
String childTargetPath = SVNPathUtil.getAbsolutePath(SVNPathUtil.append(targetPath, targetEntry.getName()));
long subMergeInfoIncrement = merge(childTargetPath, targetEntryNode, sourceEntryNode,
ancestorEntryNode, txnId);
if (myFSFS.supportsMergeInfo()) {
mergeInfoIncrement += subMergeInfoIncrement;
}
}
removedEntries.add(ancestorEntryName);
}
for (Iterator sourceEntryNames = sourceEntries.keySet().iterator(); sourceEntryNames.hasNext();) {
String sourceEntryName = (String) sourceEntryNames.next();
if (removedEntries.contains(sourceEntryName)){
continue;
}
FSEntry sourceEntry = (FSEntry) sourceEntries.get(sourceEntryName);
FSEntry targetEntry = (FSEntry) targetEntries.get(sourceEntryName);
if (targetEntry != null) {