protected void postMergeCleanup(SVNMergeFileSet files) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); if (!files.getLocalPath().equals(files.getWCPath())) { command.put(SVNLog.NAME_ATTR, files.getLocalPath()); log.addCommand(SVNLog.DELETE, command, false); command.clear(); } command.put(SVNLog.NAME_ATTR, files.getWCPath()); log.addCommand(SVNLog.MAYBE_EXECUTABLE, command, false); command.clear(); command.put(SVNLog.NAME_ATTR, files.getWCPath()); log.addCommand(SVNLog.MAYBE_READONLY, command, false); command.clear(); command.put(SVNLog.NAME_ATTR, files.getResultPath()); log.addCommand(SVNLog.DELETE, command, false); command.clear(); }
protected void postMergeCleanup(SVNMergeFileSet files) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); if (!files.getLocalPath().equals(files.getWCPath())) { if (log != null) { command.put(SVNLog.NAME_ATTR, files.getLocalPath()); log.addCommand(SVNLog.DELETE, command, false); command.clear(); } } if (log != null) { command.put(SVNLog.NAME_ATTR, files.getWCPath()); log.addCommand(SVNLog.MAYBE_EXECUTABLE, command, false); command.clear(); command.put(SVNLog.NAME_ATTR, files.getWCPath()); log.addCommand(SVNLog.MAYBE_READONLY, command, false); command.clear(); command.put(SVNLog.NAME_ATTR, files.getResultPath()); log.addCommand(SVNLog.DELETE, command, false); command.clear(); } }
protected void postMergeCleanup(SVNMergeFileSet files) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); if (!files.getLocalPath().equals(files.getWCPath())) { if (log != null) { command.put(SVNLog.NAME_ATTR, files.getLocalPath()); log.addCommand(SVNLog.DELETE, command, false); command.clear(); } } if (log != null) { command.put(SVNLog.NAME_ATTR, files.getWCPath()); log.addCommand(SVNLog.MAYBE_EXECUTABLE, command, false); command.clear(); command.put(SVNLog.NAME_ATTR, files.getWCPath()); log.addCommand(SVNLog.MAYBE_READONLY, command, false); command.clear(); command.put(SVNLog.NAME_ATTR, files.getResultPath()); log.addCommand(SVNLog.DELETE, command, false); command.clear(); } }
protected SVNMergeResult handleChooseBase(SVNMergeFileSet files) throws SVNException { SVNLog log = files.getLog(); if (log != null) { SVNProperties command = new SVNProperties(); command.put(SVNLog.NAME_ATTR, files.getBasePath()); command.put(SVNLog.DEST_ATTR, files.getWCPath()); log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false); command.clear(); } return SVNMergeResult.createMergeResult(SVNStatusType.MERGED, null); }
protected SVNMergeResult handleChooseRepository(SVNMergeFileSet files) throws SVNException { SVNLog log = files.getLog(); if (log != null) { SVNProperties command = new SVNProperties(); command.put(SVNLog.NAME_ATTR, files.getRepositoryPath()); command.put(SVNLog.DEST_ATTR, files.getWCPath()); log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false); command.clear(); } return SVNMergeResult.createMergeResult(SVNStatusType.MERGED, null); }
protected SVNMergeResult handleChooseBase(SVNMergeFileSet files) throws SVNException { SVNLog log = files.getLog(); if (log != null) { SVNProperties command = new SVNProperties(); command.put(SVNLog.NAME_ATTR, files.getBasePath()); command.put(SVNLog.DEST_ATTR, files.getWCPath()); log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false); command.clear(); } return SVNMergeResult.createMergeResult(SVNStatusType.MERGED, null); }
protected SVNMergeResult handleChooseRepository(SVNMergeFileSet files) throws SVNException { SVNLog log = files.getLog(); if (log != null) { SVNProperties command = new SVNProperties(); command.put(SVNLog.NAME_ATTR, files.getRepositoryPath()); command.put(SVNLog.DEST_ATTR, files.getWCPath()); log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false); command.clear(); } return SVNMergeResult.createMergeResult(SVNStatusType.MERGED, null); }
protected SVNMergeResult handleChooseRepository(SVNMergeFileSet files) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); command.put(SVNLog.NAME_ATTR, files.getRepositoryPath()); command.put(SVNLog.DEST_ATTR, files.getWCPath()); log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false); command.clear(); return SVNMergeResult.createMergeResult(SVNStatusType.MERGED, null); }
protected SVNMergeResult handleChooseBase(SVNMergeFileSet files) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); command.put(SVNLog.NAME_ATTR, files.getBasePath()); command.put(SVNLog.DEST_ATTR, files.getWCPath()); log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false); command.clear(); return SVNMergeResult.createMergeResult(SVNStatusType.MERGED, null); }
protected void makeTextConflictEntry(SVNMergeFileSet files, String mineFilePath, String newFilePath, String oldFilePath) throws SVNException { SVNLog log = files.getLog(); if (log != null) { SVNProperties command = new SVNProperties(); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_WRK), mineFilePath); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_NEW), newFilePath); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_OLD), oldFilePath); log.logChangedEntryProperties(files.getWCPath(), command); command.clear(); } }
protected SVNMergeResult handleMarkBinaryConflicted(SVNMergeFileSet files) throws SVNException { SVNProperties command = new SVNProperties(); File root = files.getAdminArea().getRoot(); SVNLog log = files.getLog(); File oldFile = SVNFileUtil.createUniqueFile(root, files.getWCPath(), files.getBaseLabel(), false); File newFile = SVNFileUtil.createUniqueFile(root, files.getWCPath(), files.getRepositoryLabel(), false); SVNFileUtil.copyFile(files.getBaseFile(), oldFile, false); SVNFileUtil.copyFile(files.getRepositoryFile(), newFile, false); if (!files.getLocalPath().equals(files.getWCPath())) { File mineFile = SVNFileUtil.createUniqueFile(root, files.getWCPath(), files.getLocalLabel(), false); String minePath = SVNFileUtil.getBasePath(mineFile); if (log != null) { command.put(SVNLog.NAME_ATTR, files.getLocalPath()); command.put(SVNLog.DEST_ATTR, minePath); log.addCommand(SVNLog.MOVE, command, false); command.clear(); } command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_WRK), minePath); } else { command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_WRK), ""); } String newPath = SVNFileUtil.getBasePath(newFile); String oldPath = SVNFileUtil.getBasePath(oldFile); makeBinaryConflictEntry(files, newPath, oldPath); return SVNMergeResult.createMergeResult(SVNStatusType.CONFLICTED, null); }
protected void makeBinaryConflictEntry(SVNMergeFileSet files, String newFilePath, String oldFilePath) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_NEW), newFilePath); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_OLD), oldFilePath); log.logChangedEntryProperties(files.getWCPath(), command); command.clear(); files.getAdminArea().saveEntries(false); }
protected void makeTextConflictEntry(SVNMergeFileSet files, String mineFilePath, String newFilePath, String oldFilePath) throws SVNException { SVNLog log = files.getLog(); if (log != null) { SVNProperties command = new SVNProperties(); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_WRK), mineFilePath); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_NEW), newFilePath); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_OLD), oldFilePath); log.logChangedEntryProperties(files.getWCPath(), command); command.clear(); } }
protected void makeTextConflictEntry(SVNMergeFileSet files, String mineFilePath, String newFilePath, String oldFilePath) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_WRK), mineFilePath); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_NEW), newFilePath); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_OLD), oldFilePath); log.logChangedEntryProperties(files.getWCPath(), command); command.clear(); }
protected void makeBinaryConflictEntry(SVNMergeFileSet files, String newFilePath, String oldFilePath) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); if (log != null) { command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_NEW), newFilePath); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_OLD), oldFilePath); log.logChangedEntryProperties(files.getWCPath(), command); command.clear(); } files.getAdminArea().saveEntries(false); }
protected void makeBinaryConflictEntry(SVNMergeFileSet files, String newFilePath, String oldFilePath) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); if (log != null) { command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_NEW), newFilePath); command.put(SVNProperty.shortPropertyName(SVNProperty.CONFLICT_OLD), oldFilePath); log.logChangedEntryProperties(files.getWCPath(), command); command.clear(); } files.getAdminArea().saveEntries(false); }
protected SVNMergeResult handleChooseMerged(SVNMergeFileSet files, SVNMergeResult mergeResult) throws SVNException { SVNProperties command = new SVNProperties(); SVNLog log = files.getLog(); if (mergeResult.getMergeStatus() != SVNStatusType.CONFLICTED) { // do normal merge. if (mergeResult.getMergeStatus() != SVNStatusType.UNCHANGED) { command.put(SVNLog.NAME_ATTR, files.getResultPath()); command.put(SVNLog.DEST_ATTR, files.getWCPath()); log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false); command.clear(); } return mergeResult; } else if (files.isBinary()) { // this action is not applicable for binary conflited files. return handleMarkConflicted(files); } else { // for text file we could use merged version in case of conflict. command.put(SVNLog.NAME_ATTR, files.getResultPath()); command.put(SVNLog.DEST_ATTR, files.getWCPath()); log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false); command.clear(); return SVNMergeResult.createMergeResult(SVNStatusType.MERGED, null); } }
protected SVNMergeResult handleChooseConflicted(boolean chooseMine, SVNMergeFileSet files) throws SVNException { File tmpFile = SVNAdminUtil.createTmpFile(files.getAdminArea()); setDiffConflictStyle(chooseMine ? SVNDiffConflictChoiceStyle.CHOOSE_MODIFIED : SVNDiffConflictChoiceStyle.CHOOSE_LATEST); File leftFile = files.getBaseFile(); File rightFile = files.getRepositoryFile(); File detranslatedTarget = files.getLocalFile(); mergeText(leftFile, detranslatedTarget, rightFile, getDiffOptions(), tmpFile); SVNLog log = files.getLog(); if (log != null) { SVNProperties command = new SVNProperties(); String tmpBasePath = SVNFileUtil.getBasePath(tmpFile); command.put(SVNLog.NAME_ATTR, tmpBasePath); command.put(SVNLog.DEST_ATTR, files.getWCPath()); log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false); command.clear(); command.put(SVNLog.NAME_ATTR, tmpBasePath); log.addCommand(SVNLog.DELETE, command, false); command.clear(); } return SVNMergeResult.createMergeResult(SVNStatusType.MERGED, null); }
public SVNMergeResult mergeText(SVNMergeFileSet files, boolean dryRun, SVNDiffOptions options) throws SVNException { myDiffOptions = options; SVNStatusType status; if (files.isBinary()) { status = mergeBinary(files.getBaseFile(), files.getLocalFile(), files.getRepositoryFile(), options, files.getResultFile()); } else { status = mergeText(files.getBaseFile(), files.getLocalFile(), files.getRepositoryFile(), options, files.getResultFile()); } if (!files.isBinary() && status != SVNStatusType.CONFLICTED) { if (files.getCopyFromFile() != null) { status = SVNStatusType.MERGED; } else { SVNAdminArea adminArea = files.getAdminArea(); SVNVersionedProperties props = adminArea.getProperties(files.getWCPath()); boolean isSpecial = props.getPropertyValue(SVNProperty.SPECIAL) != null; // compare merge result with 'wcFile' (in case of text and no conflict). boolean isSameContents = SVNFileUtil.compareFiles(isSpecial ? files.getLocalFile() : files.getWCFile(), files.getResultFile(), null); status = isSameContents ? SVNStatusType.UNCHANGED : status; } } final SVNMergeResult result = SVNMergeResult.createMergeResult(status, null); if (dryRun) { return result; } return processMergedFiles(files, result); }
public SVNMergeResult mergeText(SVNMergeFileSet files, boolean dryRun, SVNDiffOptions options) throws SVNException { SVNStatusType status; if (files.isBinary()) { status = mergeBinary(files.getBaseFile(), files.getLocalFile(), files.getRepositoryFile(), options, files.getResultFile()); } else { status = mergeText(files.getBaseFile(), files.getLocalFile(), files.getRepositoryFile(), options, files.getResultFile()); } if (!files.isBinary() && status != SVNStatusType.CONFLICTED) { if (files.getCopyFromFile() != null) { status = SVNStatusType.MERGED; } else { SVNAdminArea adminArea = files.getAdminArea(); SVNVersionedProperties props = adminArea.getProperties(files.getWCPath()); boolean isSpecial = props.getPropertyValue(SVNProperty.SPECIAL) != null; // compare merge result with 'wcFile' (in case of text and no conflict). boolean isSameContents = SVNFileUtil.compareFiles(isSpecial ? files.getLocalFile() : files.getWCFile(), files.getResultFile(), null); status = isSameContents ? SVNStatusType.UNCHANGED : status; } } final SVNMergeResult result = SVNMergeResult.createMergeResult(status, null); if (dryRun) { return result; } return processMergedFiles(files, result); }