FSPathChange oldChange = (FSPathChange) mapChanges.get(change.getPath()); if (oldChange != null) { copyfromPath = oldChange.getCopyPath(); copyfromRevision = oldChange.getCopyRevision(); if ((change.getRevNodeId() == null) && (FSPathChangeKind.FS_PATH_CHANGE_RESET != change.getChangeKind())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Missing required node revision ID"); SVNErrorManager.error(err); if ((change.getRevNodeId() != null) && (!oldChange.getRevNodeId().equals(change.getRevNodeId())) && (oldChange.getChangeKind() != FSPathChangeKind.FS_PATH_CHANGE_DELETE)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change ordering: new node revision ID without delete"); SVNErrorManager.error(err); if (FSPathChangeKind.FS_PATH_CHANGE_DELETE == oldChange.getChangeKind() && !(FSPathChangeKind.FS_PATH_CHANGE_REPLACE == change.getChangeKind() || FSPathChangeKind.FS_PATH_CHANGE_RESET == change.getChangeKind() || FSPathChangeKind.FS_PATH_CHANGE_ADD == change .getChangeKind())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change ordering: non-add change on deleted path"); SVNErrorManager.error(err); if (FSPathChangeKind.FS_PATH_CHANGE_MODIFY == change.getChangeKind()) { if (change.isTextModified()) { oldChange.setTextModified(true); if (change.arePropertiesModified()) { oldChange.setPropertiesModified(true); } else if (FSPathChangeKind.FS_PATH_CHANGE_ADD == change.getChangeKind() || FSPathChangeKind.FS_PATH_CHANGE_REPLACE == change.getChangeKind()) { oldChange.setChangeKind(FSPathChangeKind.FS_PATH_CHANGE_REPLACE); oldChange.setRevNodeId(change.getRevNodeId());
public void writeChangeEntry(OutputStream changesFile, FSPathChange pathChange) throws SVNException, IOException { FSPathChangeKind changeKind = pathChange.getChangeKind(); if (!(changeKind == FSPathChangeKind.FS_PATH_CHANGE_ADD || changeKind == FSPathChangeKind.FS_PATH_CHANGE_DELETE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_MODIFY || changeKind == FSPathChangeKind.FS_PATH_CHANGE_REPLACE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_RESET)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change type"); SVNErrorManager.error(err); } String changeString = changeKind.toString(); String idString = null; if (pathChange.getRevNodeId() != null) { idString = pathChange.getRevNodeId().toString(); } else { idString = FSPathChangeKind.ACTION_RESET; } String output = idString + " " + changeString + " " + SVNProperty.toString(pathChange.isTextModified()) + " " + SVNProperty.toString(pathChange.arePropertiesModified()) + " " + pathChange.getPath() + "\n"; changesFile.write(output.getBytes("UTF-8")); String copyfromPath = pathChange.getCopyPath(); long copyfromRevision = pathChange.getCopyRevision(); if (copyfromPath != null && copyfromRevision != FSRepository.SVN_INVALID_REVNUM) { String copyfromLine = copyfromRevision + " " + copyfromPath; changesFile.write(copyfromLine.getBytes("UTF-8")); } changesFile.write("\n".getBytes("UTF-8")); }
protected Map fetchAllChanges(FSFile changesFile, boolean prefolded) throws SVNException { Map changedPaths = new HashMap(); FSPathChange change = readChange(changesFile); while (change != null) { foldChange(changedPaths, change); if ((FSPathChangeKind.FS_PATH_CHANGE_DELETE == change.getChangeKind() || FSPathChangeKind.FS_PATH_CHANGE_REPLACE == change.getChangeKind()) && !prefolded) { for (Iterator curIter = changedPaths.keySet().iterator(); curIter.hasNext();) { String hashKeyPath = (String) curIter.next(); if (change.getPath().equals(hashKeyPath)) { continue; } if (SVNPathUtil.pathIsChild(change.getPath(), hashKeyPath) != null) { curIter.remove(); } } } change = readChange(changesFile); } return changedPaths; }
String changedPath = (String) paths.next(); FSPathChange change = (FSPathChange) changedPaths.get(changedPath); if (!change.arePropertiesModified()) { continue; FSPathChangeKind changeKind = change.getChangeKind(); String copyFromPath = change.getCopyPath(); long copyFromRev = change.getCopyRevision(); if (copyFromPath != null && copyFromRev >= 0) { basePath = copyFromPath;
private void writeChanges(CountingOutputStream protoFile, Map changedPaths, boolean includeNodeKind, boolean terminateList) throws SVNException, IOException { for (Iterator paths = changedPaths.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); FSPathChange change = (FSPathChange) changedPaths.get(path); FSID id = change.getRevNodeId(); if (change.getChangeKind() != FSPathChangeKind.FS_PATH_CHANGE_DELETE && !id.isTxn()) { FSRevisionNode revNode = getOwner().getRevisionNode(id); change.setRevNodeId(revNode.getId()); } writeChangeEntry(protoFile, change, includeNodeKind); } if (terminateList) { protoFile.write('\n'); } }
if (change.getChangeKind() == FSPathChangeKind.FS_PATH_CHANGE_ADD) { isAdd = true; } else if (change.getChangeKind() == FSPathChangeKind.FS_PATH_CHANGE_DELETE) { isDelete = true; } else if (change.getChangeKind() == FSPathChangeKind.FS_PATH_CHANGE_REPLACE) { isAdd = true; isDelete = true; if (change.arePropertiesModified()) { if (myCompareRoot != null) { Map oldProps = null; if (kind == SVNNodeKind.FILE && (change.isTextModified() || (realCopyFromPath != null && copyFromPath == null))) { editor.applyTextDelta(path, null); if (myCompareRoot != null) {
public Map detectChanged() throws SVNException { Map changes = getChangedPaths(); if (changes.size() == 0) { return changes; } for (Iterator paths = changes.keySet().iterator(); paths.hasNext();) { String changedPath = (String) paths.next(); FSPathChange change = (FSPathChange) changes.get(changedPath); if (change.getChangeKind() == FSPathChangeKind.FS_PATH_CHANGE_RESET) { paths.remove(); } } return changes; }
public void addChange(String path, FSID id, FSPathChangeKind changeKind, boolean textModified, boolean propsModified, long copyFromRevision, String copyFromPath) throws SVNException { OutputStream changesFile = null; try { changesFile = SVNFileUtil.openFileForWriting(myTxnRoot.getTransactionChangesFile(), true); FSPathChange pathChange = new FSPathChange(path, id, changeKind, textModified, propsModified, copyFromPath, copyFromRevision); myTxnRoot.writeChangeEntry(changesFile, pathChange); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe); } finally { SVNFileUtil.closeFile(changesFile); } }
private SVNLocationEntry addFileSmartly(String editPath, String originalPath) throws SVNException { String copyFromPath = null; long copyFromRevision = SVNRepository.INVALID_REVISION; if (mySendCopyFromArgs) { if (!isTransactionTarget()) { FSClosestCopy closestCopy = ((FSRevisionRoot) getTargetRoot()).getClosestCopy(originalPath); if (closestCopy != null) { FSRevisionRoot closestCopyRoot = closestCopy.getRevisionRoot(); String closestCopyPath = closestCopy.getPath(); if (originalPath.equals(closestCopyPath)) { FSRevisionNode closestCopyFromNode = closestCopyRoot.getRevisionNode( closestCopyPath); copyFromPath = closestCopyFromNode.getCopyFromPath(); copyFromRevision = closestCopyFromNode.getCopyFromRevision(); } } } else if (isTransactionTarget()) { FSTransactionRoot txn = (FSTransactionRoot) getTargetRoot(); FSPathChange change = (FSPathChange) txn.getChangedPaths().get(originalPath); if (change != null) { copyFromPath = change.getCopyPath(); copyFromRevision = change.getCopyRevision(); } } } myEditor.addFile(editPath, copyFromPath, copyFromRevision); return new SVNLocationEntry(copyFromRevision, copyFromPath); }
private FSPathChange readChange(FSFile raReader) throws SVNException { String changeLine = null; try { changeLine = raReader.readLine(4096); } catch (SVNException svne) { if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.STREAM_UNEXPECTED_EOF) { return null; } throw svne; } if (changeLine == null || changeLine.length() == 0) { return null; } String copyfromLine = raReader.readLine(4096); return FSPathChange.fromString(changeLine, copyfromLine); }
public void writeChangeEntry(OutputStream changesFile, FSPathChange pathChange, boolean includeNodeKind) throws SVNException, IOException { FSPathChangeKind changeKind = pathChange.getChangeKind(); if (!(changeKind == FSPathChangeKind.FS_PATH_CHANGE_ADD || changeKind == FSPathChangeKind.FS_PATH_CHANGE_DELETE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_MODIFY || changeKind == FSPathChangeKind.FS_PATH_CHANGE_REPLACE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_RESET)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change type"); SVNErrorManager.error(err, SVNLogType.FSFS); } String changeString = changeKind.toString(); if (includeNodeKind) { changeString += "-" + pathChange.getKind().toString(); } String idString = null; if (pathChange.getRevNodeId() != null) { idString = pathChange.getRevNodeId().toString(); } else { idString = FSPathChangeKind.ACTION_RESET; } String output = idString + " " + changeString + " " + SVNProperty.toString(pathChange.isTextModified()) + " " + SVNProperty.toString(pathChange.arePropertiesModified()) + " " + pathChange.getPath() + "\n"; changesFile.write(output.getBytes("UTF-8")); String copyfromPath = pathChange.getCopyPath(); long copyfromRevision = pathChange.getCopyRevision(); if (copyfromPath != null && copyfromRevision != SVNRepository.INVALID_REVISION) { String copyfromLine = copyfromRevision + " " + copyfromPath; changesFile.write(copyfromLine.getBytes("UTF-8")); } changesFile.write("\n".getBytes("UTF-8")); }
String changedPath = (String) paths.next(); FSPathChange change = (FSPathChange) changedPaths.get(changedPath); if (!change.arePropertiesModified()) { continue; FSPathChangeKind changeKind = change.getChangeKind(); String copyFromPath = change.getCopyPath(); long copyFromRev = change.getCopyRevision(); if (copyFromPath != null && copyFromRev >= 0) { basePath = copyFromPath;
public long writeFinalChangedPathInfo(final CountingStream protoFile) throws SVNException, IOException { long offset = protoFile.getPosition(); Map changedPaths = getChangedPaths(); for (Iterator paths = changedPaths.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); FSPathChange change = (FSPathChange) changedPaths.get(path); FSID id = change.getRevNodeId(); if (change.getChangeKind() != FSPathChangeKind.FS_PATH_CHANGE_DELETE && !id.isTxn()) { FSRevisionNode revNode = getOwner().getRevisionNode(id); change.setRevNodeId(revNode.getId()); } writeChangeEntry(protoFile, change); } return offset; }
if (change == null) { return false; } else if (change.getChangeKind() == FSPathChangeKind.FS_PATH_CHANGE_ADD) { isAdd = true; } else if (change.getChangeKind() == FSPathChangeKind.FS_PATH_CHANGE_DELETE) { isDelete = true; } else if (change.getChangeKind() == FSPathChangeKind.FS_PATH_CHANGE_REPLACE) { isAdd = true; isDelete = true; if (change.arePropertiesModified()) { if (myCompareRoot != null) { SVNProperties oldProps = null; if (kind == SVNNodeKind.FILE && (change.isTextModified() || (realCopyFromPath != null && copyFromPath == null))) { String checksum = null; if (myCompareRoot != null && srcRoot != null && srcPath != null) {
protected Map fetchAllChanges(FSFile changesFile, boolean prefolded) throws SVNException { Map changedPaths = new SVNHashMap(); FSPathChange change = readChange(changesFile); while (change != null) { foldChange(changedPaths, change); if ((FSPathChangeKind.FS_PATH_CHANGE_DELETE == change.getChangeKind() || FSPathChangeKind.FS_PATH_CHANGE_REPLACE == change.getChangeKind()) && !prefolded) { for (Iterator curIter = changedPaths.keySet().iterator(); curIter.hasNext();) { String hashKeyPath = (String) curIter.next(); if (change.getPath().equals(hashKeyPath)) { continue; } if (SVNPathUtil.getPathAsChild(change.getPath(), hashKeyPath) != null) { curIter.remove(); } } } change = readChange(changesFile); } return changedPaths; }
public Map detectChanged() throws SVNException { Map changes = getChangedPaths(); if (changes.size() == 0) { return changes; } for (Iterator paths = changes.keySet().iterator(); paths.hasNext();) { String changedPath = (String) paths.next(); FSPathChange change = (FSPathChange) changes.get(changedPath); if (change.getChangeKind() == FSPathChangeKind.FS_PATH_CHANGE_RESET) { paths.remove(); } } return changes; }
return new FSPathChange(pathStr, nodeRevID, changesKind, textModeBool, propModeBool, copyfromPath, copyfromRevision);
private FSPathChange readChange(FSFile raReader) throws SVNException { String changeLine = null; try { changeLine = raReader.readLine(4096); } catch (SVNException svne) { if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.STREAM_UNEXPECTED_EOF) { return null; } throw svne; } if (changeLine == null || changeLine.length() == 0) { return null; } String copyfromLine = raReader.readLine(4096); return FSPathChange.fromString(changeLine, copyfromLine); }
FSPathChange oldChange = (FSPathChange) mapChanges.get(change.getPath()); if (oldChange != null) { copyfromPath = oldChange.getCopyPath(); copyfromRevision = oldChange.getCopyRevision(); if ((change.getRevNodeId() == null) && (FSPathChangeKind.FS_PATH_CHANGE_RESET != change.getChangeKind())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Missing required node revision ID"); SVNErrorManager.error(err, SVNLogType.FSFS); if ((change.getRevNodeId() != null) && (!oldChange.getRevNodeId().equals(change.getRevNodeId())) && (oldChange.getChangeKind() != FSPathChangeKind.FS_PATH_CHANGE_DELETE)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change ordering: new node revision ID without delete"); SVNErrorManager.error(err, SVNLogType.FSFS); if (FSPathChangeKind.FS_PATH_CHANGE_DELETE == oldChange.getChangeKind() && !(FSPathChangeKind.FS_PATH_CHANGE_REPLACE == change.getChangeKind() || FSPathChangeKind.FS_PATH_CHANGE_RESET == change.getChangeKind() || FSPathChangeKind.FS_PATH_CHANGE_ADD == change .getChangeKind())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change ordering: non-add change on deleted path"); SVNErrorManager.error(err, SVNLogType.FSFS); if (FSPathChangeKind.FS_PATH_CHANGE_MODIFY == change.getChangeKind()) { if (change.isTextModified()) { oldChange.setTextModified(true); if (change.arePropertiesModified()) { oldChange.setPropertiesModified(true); } else if (FSPathChangeKind.FS_PATH_CHANGE_ADD == change.getChangeKind() || FSPathChangeKind.FS_PATH_CHANGE_REPLACE == change.getChangeKind()) { oldChange.setChangeKind(FSPathChangeKind.FS_PATH_CHANGE_REPLACE); oldChange.setRevNodeId(change.getRevNodeId());
public void writeChangeEntry(OutputStream changesFile, FSPathChange pathChange, boolean includeNodeKind) throws SVNException, IOException { FSPathChangeKind changeKind = pathChange.getChangeKind(); if (!(changeKind == FSPathChangeKind.FS_PATH_CHANGE_ADD || changeKind == FSPathChangeKind.FS_PATH_CHANGE_DELETE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_MODIFY || changeKind == FSPathChangeKind.FS_PATH_CHANGE_REPLACE || changeKind == FSPathChangeKind.FS_PATH_CHANGE_RESET)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Invalid change type"); SVNErrorManager.error(err, SVNLogType.FSFS); } String changeString = changeKind.toString(); if (includeNodeKind) { changeString += "-" + pathChange.getKind().toString(); } String idString = null; if (pathChange.getRevNodeId() != null) { idString = pathChange.getRevNodeId().toString(); } else { idString = FSPathChangeKind.ACTION_RESET; } String output = idString + " " + changeString + " " + SVNProperty.toString(pathChange.isTextModified()) + " " + SVNProperty.toString(pathChange.arePropertiesModified()) + " " + pathChange.getPath() + "\n"; changesFile.write(output.getBytes("UTF-8")); String copyfromPath = pathChange.getCopyPath(); long copyfromRevision = pathChange.getCopyRevision(); if (copyfromPath != null && copyfromRevision != SVNRepository.INVALID_REVISION) { String copyfromLine = copyfromRevision + " " + copyfromPath; changesFile.write(copyfromLine.getBytes("UTF-8")); } changesFile.write("\n".getBytes("UTF-8")); }