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; }
public void setTreeConflicts(Map treeConflicts) throws SVNException { String conflictData = SVNTreeConflictUtil.getTreeConflictData(treeConflicts); setTreeConflictData(conflictData); }
public static String getTreeConflictData(Map conflicts) throws SVNException { if (conflicts == null) { return null; } byte[] rawData = getTreeConflictRawData(conflicts); String conflictData; try { conflictData = new String(rawData, "UTF-8"); } catch (UnsupportedEncodingException e) { conflictData = new String(rawData); } return conflictData; }
public static byte[] getSingleTreeConflictRawData(SVNTreeConflictDescription conflict) throws SVNException { SVNConflictVersion nullVersion = new SVNConflictVersion(null, null, SVNRepository.INVALID_REVISION, SVNNodeKind.UNKNOWN); SVNSkel conflictSkel = getConflictSkel(nullVersion, conflict); if (!isValidConflict(conflictSkel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Failed to create valid conflict description skel: ''{0}''", conflictSkel.toString()); SVNErrorManager.error(error, SVNLogType.WC); } return conflictSkel.unparse(); }
private static SVNTreeConflictDescription readSingleTreeConflict(SVNSkel skel, File dirPath) throws SVNException { if (!isValidConflict(skel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid conflict info in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } if (skel.getChild(1).getData().length == 0) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Empty \'victim\' field in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } String victimBasename = skel.getChild(1).getValue(); SVNNodeKind kind = getNodeKind(skel.getChild(2).getValue()); if (kind != SVNNodeKind.FILE && kind != SVNNodeKind.DIR) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid \'node_kind\' field in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } SVNOperation operation = getOperation(skel.getChild(3).getValue()); SVNConflictAction action = getAction(skel.getChild(4).getValue()); SVNConflictReason reason = getConflictReason(skel.getChild(5).getValue()); SVNConflictVersion srcLeftVersion = readConflictVersion(skel.getChild(6)); SVNConflictVersion srcRightVersion = readConflictVersion(skel.getChild(7)); return new SVNTreeConflictDescription(new File(dirPath, victimBasename), kind, action, reason, operation, srcLeftVersion, srcRightVersion); }
prependVersionInfo(conflictSkel, sourceRightVersion); prependVersionInfo(conflictSkel, sourceLeftVersion); SVNErrorManager.error(error, SVNLogType.WC); conflictSkel.addChild(SVNSkel.createAtom(getNodeKindString(conflict.getNodeKind()))); conflictSkel.addChild(SVNSkel.createAtom("conflict")); if (!isValidConflict(conflictSkel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Failed to create valid conflict description skel: ''{0}''", skel.toString());
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; }
private static SVNConflictVersion readConflictVersion(SVNSkel skel) throws SVNException { if (!isValidVersionInfo(skel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid version info in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } String repoURLString = skel.getChild(1).getValue(); SVNURL repoURL = repoURLString.length() == 0 ? null : SVNURL.parseURIEncoded(repoURLString); long pegRevision = Long.parseLong(skel.getChild(2).getValue()); String path = skel.getChild(3).getValue(); path = path.length() == 0 ? null : path; SVNNodeKind kind = getNodeKind(skel.getChild(4).getValue()); return new SVNConflictVersion(repoURL, path, pegRevision, kind); }
private static SVNSkel prependVersionInfo(SVNSkel parent, SVNConflictVersion versionInfo) throws SVNException { parent = parent == null ? SVNSkel.createEmptyList() : parent; SVNSkel skel = SVNSkel.createEmptyList(); skel.prepend(SVNSkel.createAtom(getNodeKindString(versionInfo.getKind()))); String path = versionInfo.getPath() == null ? "" : versionInfo.getPath(); skel.prepend(SVNSkel.createAtom(path)); skel.prepend(SVNSkel.createAtom(String.valueOf(versionInfo.getPegRevision()))); String repoURLString = versionInfo.getRepositoryRoot() == null ? "" : versionInfo.getRepositoryRoot().toString(); skel.prepend(SVNSkel.createAtom(repoURLString)); skel.prepend(SVNSkel.createAtom("version")); if (!isValidVersionInfo(skel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Failed to create valid conflict version skel: ''{0}''", skel.toString()); SVNErrorManager.error(error, SVNLogType.WC); } parent.prepend(skel); return parent; }
public static SVNSkel getConflictSkel(SVNConflictVersion nullVersion, SVNTreeConflictDescription conflict) throws SVNException { SVNSkel conflictSkel = SVNSkel.createEmptyList(); SVNConflictVersion sourceRightVersion = conflict.getSourceRightVersion(); sourceRightVersion = sourceRightVersion == null ? nullVersion : sourceRightVersion; prependVersionInfo(conflictSkel, sourceRightVersion); SVNConflictVersion sourceLeftVersion = conflict.getSourceLeftVersion(); sourceLeftVersion = sourceLeftVersion == null ? nullVersion : sourceLeftVersion; prependVersionInfo(conflictSkel, sourceLeftVersion); conflictSkel.prepend(SVNSkel.createAtom(conflict.getConflictReason().toString())); conflictSkel.prepend(SVNSkel.createAtom(conflict.getConflictAction().toString())); conflictSkel.prepend(SVNSkel.createAtom(conflict.getOperation().toString())); if (conflict.getNodeKind() != SVNNodeKind.DIR && conflict.getNodeKind() != SVNNodeKind.FILE) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid \'node_kind\' field in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } conflictSkel.prepend(SVNSkel.createAtom(getNodeKindString(conflict.getNodeKind()))); String path = conflict.getPath().getName(); if (path.length() == 0) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Empty path basename in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } conflictSkel.prepend(SVNSkel.createAtom(path)); conflictSkel.prepend(SVNSkel.createAtom("conflict")); return conflictSkel; }
public static String getHumanReadableConflictVersion(SVNConflictVersion version) { String url = version.getRepositoryRoot() != null ? version.getRepositoryRoot().toString() : null; if (url != null && version.getPath() != null) { url = url + "/" + version.getPath(); } else if (url != null) { url = url + "/..."; } else if (version.getPath() != null) { url = version.getPath(); } else { url = "..."; } return "(" + getNodeKindString(version.getKind()) + ") " + url + "@" + version.getPegRevision(); }
public static SVNTreeConflictDescription readSingleTreeConflict(SVNSkel skel, File dirPath) throws SVNException { if (!isValidConflict(skel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid conflict info in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } if (skel.getChild(1).getData().length == 0) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Empty \'victim\' field in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } String victimBasename = skel.getChild(1).getValue(); SVNNodeKind kind = getNodeKind(skel.getChild(2).getValue()); if (kind != SVNNodeKind.FILE && kind != SVNNodeKind.DIR) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid \'node_kind\' field in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } SVNOperation operation = getOperation(skel.getChild(3).getValue()); SVNConflictAction action = getAction(skel.getChild(4).getValue()); SVNConflictReason reason = getConflictReason(skel.getChild(5).getValue()); SVNConflictVersion srcLeftVersion = readConflictVersion(skel.getChild(6)); SVNConflictVersion srcRightVersion = readConflictVersion(skel.getChild(7)); return new SVNTreeConflictDescription(new File(dirPath, victimBasename), kind, action, reason, operation, srcLeftVersion, srcRightVersion); }
prependVersionInfo(conflictSkel, sourceRightVersion); prependVersionInfo(conflictSkel, sourceLeftVersion); SVNErrorManager.error(error, SVNLogType.WC); conflictSkel.addChild(SVNSkel.createAtom(getNodeKindString(conflict.getNodeKind()))); conflictSkel.addChild(SVNSkel.createAtom("conflict")); if (!isValidConflict(conflictSkel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Failed to create valid conflict description skel: ''{0}''", skel.toString());
private static SVNConflictVersion readConflictVersion(SVNSkel skel) throws SVNException { if (!isValidVersionInfo(skel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid version info in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } String repoURLString = skel.getChild(1).getValue(); SVNURL repoURL = repoURLString.length() == 0 ? null : SVNURL.parseURIEncoded(repoURLString); long pegRevision = Long.parseLong(skel.getChild(2).getValue()); String path = skel.getChild(3).getValue(); path = path.length() == 0 ? null : path; SVNNodeKind kind = getNodeKind(skel.getChild(4).getValue()); return new SVNConflictVersion(repoURL, path, pegRevision, kind); }
private static SVNSkel prependVersionInfo(SVNSkel parent, SVNConflictVersion versionInfo) throws SVNException { parent = parent == null ? SVNSkel.createEmptyList() : parent; SVNSkel skel = SVNSkel.createEmptyList(); skel.addChild(SVNSkel.createAtom(getNodeKindString(versionInfo.getKind()))); String path = versionInfo.getPath() == null ? "" : versionInfo.getPath(); skel.addChild(SVNSkel.createAtom(path)); skel.addChild(SVNSkel.createAtom(String.valueOf(versionInfo.getPegRevision()))); String repoURLString = versionInfo.getRepositoryRoot() == null ? "" : versionInfo.getRepositoryRoot().toString(); skel.addChild(SVNSkel.createAtom(repoURLString)); skel.addChild(SVNSkel.createAtom("version")); if (!isValidVersionInfo(skel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Failed to create valid conflict version skel: ''{0}''", skel.toString()); SVNErrorManager.error(error, SVNLogType.WC); } parent.addChild(skel); return parent; }
public static byte[] getTreeConflictRawData(Map conflicts) throws SVNException { if (conflicts == null) { return null; } SVNConflictVersion nullVersion = new SVNConflictVersion(null, null, SVNRepository.INVALID_REVISION, SVNNodeKind.UNKNOWN); SVNSkel skel = SVNSkel.createEmptyList(); for (Iterator iterator = conflicts.values().iterator(); iterator.hasNext();) { SVNTreeConflictDescription conflict = (SVNTreeConflictDescription) iterator.next(); SVNSkel conflictSkel = getConflictSkel(nullVersion, conflict); if (!isValidConflict(conflictSkel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Failed to create valid conflict description skel: ''{0}''", skel.toString()); SVNErrorManager.error(error, SVNLogType.WC); } skel.prepend(conflictSkel); } return skel.unparse(); }
public static String getHumanReadableConflictVersion(SVNConflictVersion version) { String url = version.getRepositoryRoot() != null ? version.getRepositoryRoot().toString() : null; if (url != null && version.getPath() != null) { url = url + "/" + version.getPath(); } else if (url != null) { url = url + "/..."; } else if (version.getPath() != null) { url = version.getPath(); } else { url = "..."; } return "(" + getNodeKindString(version.getKind()) + ") " + url + "@" + version.getPegRevision(); }
private static SVNTreeConflictDescription readSingleTreeConflict(SVNSkel skel, File dirPath) throws SVNException { if (!isValidConflict(skel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid conflict info in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } if (skel.getChild(1).getData().length == 0) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Empty \'victim\' field in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } String victimBasename = skel.getChild(1).getValue(); SVNNodeKind kind = getNodeKind(skel.getChild(2).getValue()); if (kind != SVNNodeKind.FILE && kind != SVNNodeKind.DIR) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid \'node_kind\' field in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } SVNOperation operation = getOperation(skel.getChild(3).getValue()); SVNConflictAction action = getAction(skel.getChild(4).getValue()); SVNConflictReason reason = getConflictReason(skel.getChild(5).getValue()); SVNConflictVersion srcLeftVersion = readConflictVersion(skel.getChild(6)); SVNConflictVersion srcRightVersion = readConflictVersion(skel.getChild(7)); return new SVNTreeConflictDescription(new File(dirPath, victimBasename), kind, action, reason, operation, srcLeftVersion, srcRightVersion); }
public void setTreeConflicts(Map treeConflicts) throws SVNException { String conflictData = SVNTreeConflictUtil.getTreeConflictData(treeConflicts); setTreeConflictData(conflictData); }
private static SVNConflictVersion readConflictVersion(SVNSkel skel) throws SVNException { if (!isValidVersionInfo(skel)) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_CORRUPT, "Invalid version info in tree conflict description"); SVNErrorManager.error(error, SVNLogType.WC); } String repoURLString = skel.getChild(1).getValue(); SVNURL repoURL = repoURLString.length() == 0 ? null : SVNURL.parseURIEncoded(repoURLString); if (repoURL == null) { return null; } long pegRevision = Long.parseLong(skel.getChild(2).getValue()); String path = skel.getChild(3).getValue(); path = path.length() == 0 ? null : path; SVNNodeKind kind = getNodeKind(skel.getChild(4).getValue()); return new SVNConflictVersion(repoURL, path, pegRevision, kind); }