protected void recordTreeConflictOnAdd(File victim, SVNAdminArea adminArea, SVNNodeKind kind, SVNConflictAction action, SVNConflictReason reason) throws SVNException { if (myIsRecordOnly || myIsDryRun) { return; } SVNTreeConflictDescription conflict = makeTreeConflict(victim, kind, action, reason); SVNTreeConflictDescription existingConflict = myWCAccess.getTreeConflict(conflict.getPath()); if (existingConflict != null && existingConflict.getConflictAction() == SVNConflictAction.DELETE && conflict.getConflictAction() == SVNConflictAction.ADD) { adminArea.deleteTreeConflict(conflict.getPath().getName()); conflict = new SVNTreeConflictDescription(conflict.getPath(), conflict.getNodeKind(), SVNConflictAction.DELETE, existingConflict.getConflictReason(), conflict.getOperation(), existingConflict.getSourceLeftVersion(), conflict.getSourceRightVersion()); } adminArea.addTreeConflict(conflict); }
/** * Returns the wc file. * @return detranslated wc file * @since 1.3 */ public File getPath() { return getMergeFiles().getLocalFile(); }
private static String getReasonString(SVNTreeConflictDescription treeConflict) { final SVNConflictReason reason = treeConflict.getConflictReason(); if (reason == SVNConflictReason.EDITED) { return "edit"; } else if (reason == SVNConflictReason.OBSTRUCTED) { return "obstruction"; } else if (reason == SVNConflictReason.DELETED) { return "delete"; } else if (reason == SVNConflictReason.MISSING) { if (treeConflict.getOperation() == SVNOperation.MERGE) { return "missing or deleted or moved away"; } else { return "missing"; } } else if (reason == SVNConflictReason.UNVERSIONED) { return "unversioned"; } else if (reason == SVNConflictReason.ADDED) { return "add"; } else if (reason == SVNConflictReason.REPLACED) { return "replace"; } else if (reason == SVNConflictReason.MOVED_AWAY) { return "moved away"; } else if (reason == SVNConflictReason.MOVED_HERE) { return "moved here"; } return null; }
public static SVNSkel treeConflictDescriptionToSkel(ISVNWCDb db, File wriAbsPath, SVNTreeConflictDescription conflictDescription) throws SVNException { SVNSkel skel = createConflictSkel(); addTreeConflict(skel, db, wriAbsPath, conflictDescription.getConflictReason(), conflictDescription.getConflictAction(), null); if (conflictDescription.getOperation() != null) { if (conflictDescription.getOperation() == SVNOperation.UPDATE) { SvnWcDbConflicts.conflictSkelOpUpdate(skel, conflictDescription.getSourceLeftVersion(), conflictDescription.getSourceRightVersion()); } else if (conflictDescription.getOperation() == SVNOperation.SWITCH) { SvnWcDbConflicts.conflictSkelOpSwitch(skel, conflictDescription.getSourceLeftVersion(), conflictDescription.getSourceRightVersion()); } else if (conflictDescription.getOperation() == SVNOperation.MERGE) { SvnWcDbConflicts.conflictSkelOpMerge(skel, conflictDescription.getSourceLeftVersion(), conflictDescription.getSourceRightVersion()); } } return skel; }
if (conflictDescription.isTreeConflict()) { SVNTreeConflictDescription tc = (SVNTreeConflictDescription) conflictDescription; left = createConflictVersion(tc.getSourceLeftVersion()); right = createConflictVersion(tc.getSourceRightVersion()); op = getConflictOperation(tc.getOperation());
final SVNTreeConflictDescription tcDesc = SVNTreeConflictUtil.readSingleTreeConflict(tcSkel, localAbsPath); final SVNWCConflictDescription17 conflictDescription = SVNWCConflictDescription17.createTree(localAbsPath, tcDesc.getNodeKind(), tcDesc.getOperation(), tcDesc.getSourceLeftVersion(), tcDesc.getSourceRightVersion()); conflictDescription.setAction(tcDesc.getConflictAction()); conflictDescription.setReason(tcDesc.getConflictReason()); if (tcDesc.getMergeFiles() != null) { conflictDescription.setMyFile(tcDesc.getMergeFiles().getLocalFile());
public static String getHumanReadableConflictDescription(SVNTreeConflictDescription treeConflict) { SVNNodeKind incomingKind = SVNNodeKind.UNKNOWN; if (treeConflict.getConflictAction() == SVNConflictAction.EDIT || treeConflict.getConflictAction() == SVNConflictAction.DELETE) { if (treeConflict.getSourceLeftVersion() != null) { incomingKind = treeConflict.getSourceLeftVersion().getKind(); } } else if (treeConflict.getConflictAction() == SVNConflictAction.ADD || treeConflict.getConflictAction() == SVNConflictAction.REPLACE) { if (treeConflict.getSourceRightVersion() != null) { incomingKind = treeConflict.getSourceRightVersion().getKind(); } } final String reasonStr = getReasonString(treeConflict); final String actionStr = getActionString(incomingKind, treeConflict); final String operationStr = treeConflict.getOperation().getName(); String kindWithSpaceStr = getNodeKindString(treeConflict.getNodeKind()); if (kindWithSpaceStr.length() > 0) { kindWithSpaceStr = kindWithSpaceStr + " "; } final String description = String.format("local %s%s, incoming %s upon %s", kindWithSpaceStr, reasonStr, actionStr, operationStr); return description; }
String description = SVNTreeConflictUtil.getHumanReadableConflictDescription(tc); buffer.append("Tree conflict: " + description + "\n"); SVNConflictVersion left = tc.getSourceLeftVersion(); buffer.append(" Source left: " + SVNTreeConflictUtil.getHumanReadableConflictVersion(left) + "\n"); SVNConflictVersion right = tc.getSourceRightVersion(); buffer.append(" Source right: " + SVNTreeConflictUtil.getHumanReadableConflictVersion(right) + "\n");
public static Map readTreeConflicts(File dirPath, byte[] conflictData) throws SVNException { Map conflicts = new SVNHashMap(); if (conflictData == null) { return conflicts; } SVNSkel skel = SVNSkel.parse(conflictData); if (skel == null || skel.isAtom()) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Error parsing tree conflict skel"); SVNErrorManager.error(error, SVNLogType.WC); } for (Iterator iterator = skel.getList().iterator(); iterator.hasNext();) { SVNSkel conflictSkel = (SVNSkel) iterator.next(); SVNTreeConflictDescription conflict = readSingleTreeConflict(conflictSkel, dirPath); if (conflict != null) { conflicts.put(conflict.getPath(), conflict); } } return conflicts; }
private static String getReasonString(SVNTreeConflictDescription treeConflict) { SVNConflictReason reason = treeConflict.getConflictReason(); if (reason == SVNConflictReason.EDITED) { return "edit"; } else if (reason == SVNConflictReason.OBSTRUCTED) { return "obstruction"; } else if (reason == SVNConflictReason.DELETED) { return "delete"; } else if (reason == SVNConflictReason.ADDED) { return "add"; } else if (reason == SVNConflictReason.MISSING) { return "missing"; } else if (reason == SVNConflictReason.UNVERSIONED) { return "unversioned"; } return null; }
public void handleEntry(File path, SVNEntry entry) throws SVNException { myDelegate.handleEntry(path, entry); if (entry == null || !entry.isDirectory() || entry.isHidden()) { return; } boolean checkChildren = false; if (myDepth == SVNDepth.IMMEDIATES || myDepth == SVNDepth.FILES) { checkChildren = path.equals(myTargetPath); } else if (myDepth == SVNDepth.INFINITY || myDepth == SVNDepth.EXCLUDE || myDepth == SVNDepth.UNKNOWN) { checkChildren = true; } else { return; } if (!checkChildren) { return; } Map tcs = entry.getTreeConflicts(); for(Iterator paths = tcs.keySet().iterator(); paths.hasNext();) { File p = (File) paths.next(); SVNTreeConflictDescription tc = (SVNTreeConflictDescription) tcs.get(p); if (tc.getNodeKind() == SVNNodeKind.DIR && myDepth == SVNDepth.FILES) { continue; } SVNEntry conflictEntry = myWCAccess.getEntry(p, true); if (conflictEntry == null || conflictEntry.isDeleted()) { myDelegate.handleEntry(p, null); } } }
if (treeConflict != null && treeConflict.getConflictAction() == SVNConflictAction.EDIT) { if (treeConflict != null && treeConflict.getConflictReason() == SVNConflictReason.DELETED && !inDeletedTree(fullPath, true)) { addDeletedTree(fullPath); if (hasPropConflicts || (treeConflict != null && treeConflict.getConflictReason() != SVNConflictReason.DELETED)) { return;
File entryPath = keys.next(); SVNTreeConflictDescription conflict = (SVNTreeConflictDescription) tcs.get(entryPath); assert(conflict.isTreeConflict()); if (conflict.getConflictReason() == SVNConflictReason.ADDED) { conflict.setSourceLeftVersion(null); String key = SVNFileUtil.getFilePath(SVNWCUtils.skipAncestor(rootAbsPath, conflict.getPath())); treeConflicts.put(key, SVNTreeConflictUtil.getSingleTreeConflictData(conflict));
private static void bailOnTreeConflictedChildren(SVNWCContext context, File localAbsPath, SVNNodeKind kind, SVNDepth depth, Collection<String> changelistsSet) throws SVNException { if ((depth == SVNDepth.EMPTY) || (kind != SVNNodeKind.DIR)) { return; } Map<String, SVNTreeConflictDescription> conflicts = context.getDb().opReadAllTreeConflicts(localAbsPath); if (conflicts == null || conflicts.isEmpty()) { return; } for (SVNTreeConflictDescription conflict : conflicts.values()) { if ((conflict.getNodeKind() == SVNNodeKind.DIR) && (depth == SVNDepth.FILES)) { continue; } if (!context.isChangelistMatch(localAbsPath, changelistsSet)) { continue; } SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_FOUND_CONFLICT, "Aborting commit: ''{0}'' remains in conflict", conflict.getPath()); SVNErrorManager.error(err, SVNLogType.WC); } }
SVNTreeConflictDescription treeConflict = new SVNTreeConflictDescription(path, entry.getKind(), action, reason, mySwitchURL != null ? SVNOperation.SWITCH : SVNOperation.UPDATE, srcLeftVersion, srcRightVersion); conflicts.put(treeConflict.getPath(), treeConflict); String conflictData = SVNTreeConflictUtil.getTreeConflictData(conflicts); SVNProperties command = new SVNProperties();
private SVNTreeConflictDescription makeTreeConflict(File path, SVNNodeKind kind, SVNConflictAction action, SVNConflictReason reason) throws SVNException { final SVNConflictVersion[] cvs = makeConflictVersions(path, kind); final SVNTreeConflictDescription tc = new SVNTreeConflictDescription(path, kind, action, reason, SVNOperation.MERGE, cvs[0], cvs[1]); return tc; }
public static String getHumanReadableConflictDescription(SVNTreeConflictDescription treeConflict) { String reasonStr = getReasonString(treeConflict); String actionStr = getActionString(treeConflict); String operationStr = treeConflict.getOperation().getName(); String description = "local " + reasonStr + ", incoming " + actionStr + " upon " + operationStr; return description; }
private static String getActionString(SVNTreeConflictDescription treeConflict) { SVNConflictAction action = treeConflict.getConflictAction(); if (action == SVNConflictAction.ADD) { return "add"; } else if (action == SVNConflictAction.EDIT) { return "edit"; } else if (action == SVNConflictAction.DELETE) { return "delete"; } return null; }
private void treeConflictOnAdd(File path, SVNNodeKind kind, SVNConflictAction action, SVNConflictReason reason) throws SVNException { if (isRecordOnly() || isDryRun()) { return; } SVNTreeConflictDescription tc = makeTreeConflict(path, kind, action, reason); SVNTreeConflictDescription existingTc = getContext().getTreeConflict(path); if (existingTc == null) { getContext().getDb().opSetTreeConflict(path, tc); if (conflictedPaths == null) { conflictedPaths = new HashSet<File>(); } conflictedPaths.add(path); } else if (existingTc.getConflictAction() == SVNConflictAction.DELETE && tc.getConflictAction() == SVNConflictAction.ADD) { existingTc.setConflictAction(SVNConflictAction.REPLACE); getContext().getDb().opSetTreeConflict(path, existingTc); } }
public static SVNSkel convertToConflictSkel(String conflictOld, String conflictWorking, String conflictNew, String propReject, byte[] treeConflictData) throws SVNException { SVNSkel conflictData = null; if (conflictOld != null || conflictNew != null || conflictWorking != null) { conflictData = createConflictSkel(); addTextConflict(conflictData, conflictWorking, conflictOld, conflictNew); } if (propReject != null) { if (conflictData == null) { conflictData = createConflictSkel(); } addPropConflict(conflictData, propReject); } if (treeConflictData != null) { if (conflictData == null) { conflictData = createConflictSkel(); } final SVNSkel tcSkel = SVNSkel.parse(treeConflictData); final File fakePath = SVNFileUtil.createFilePath(""); final SVNTreeConflictDescription tcDesc = SVNTreeConflictUtil.readSingleTreeConflict(tcSkel, fakePath); addTreeConflict(conflictData, tcDesc.getConflictReason(), tcDesc.getConflictAction()); if (tcDesc.getOperation() != null && tcDesc.getOperation() != SVNOperation.NONE) { setConflictOperation(conflictData, tcDesc.getOperation(), tcDesc.getSourceLeftVersion(), tcDesc.getSourceRightVersion()); } } else if (conflictData != null) { setConflictOperation(conflictData, SVNOperation.UPDATE, null, null); } return conflictData; }