private void deltifyFiles(FSRevisionRoot srcRoot, FSRevisionRoot tgtRoot, String srcPath, String tgtPath, String editPath) throws SVNException { deltifyProperties(srcRoot, tgtRoot, srcPath, tgtPath, editPath, false); boolean changed = false; if (srcPath != null) { if (myIsIgnoreAncestry) { changed = FSRepositoryUtil.checkFilesDifferent(srcRoot, srcPath, tgtRoot, tgtPath, myDeltaCombiner); } else { changed = FSRepositoryUtil.areFileContentsChanged(srcRoot, srcPath, tgtRoot, tgtPath); } } if (changed) { String srcHexDigest = null; if (srcPath != null) { FSRevisionNode srcNode = srcRoot.getRevisionNode(srcPath); srcHexDigest = srcNode.getFileMD5Checksum(); } FSRepositoryUtil.sendTextDelta(myEditor, editPath, srcPath, srcHexDigest, srcRoot, tgtPath, tgtRoot, myIsSendTextDeltas, myDeltaCombiner, myDeltaGenerator, myFSFS); } }
public static boolean arePropertiesEqual(FSRevisionNode revNode1, FSRevisionNode revNode2) { return areRepresentationsEqual(revNode1, revNode2, true); }
private void packPhysicallyAddressed(FSFS fsfs, long shard, File shardPath, File packFile, File manifestFile) throws SVNException { long startRev = shard * fsfs.getMaxFilesPerDirectory(); long endRev = (shard + 1) * fsfs.getMaxFilesPerDirectory() - 1; long nextOffset = 0; OutputStream packFileOS = null; OutputStream manifestFileOS = null; try { packFileOS = SVNFileUtil.openFileForWriting(packFile); manifestFileOS = SVNFileUtil.openFileForWriting(manifestFile); for (long rev = startRev; rev <= endRev; rev++) { File path = new File(shardPath, String.valueOf(rev)); String line = String.valueOf(nextOffset) + '\n'; manifestFileOS.write(line.getBytes("UTF-8")); nextOffset += path.length(); InputStream revIS = null; try { revIS = SVNFileUtil.openFileForReading(path); FSRepositoryUtil.copy(revIS, packFileOS, myCanceller); } finally { SVNFileUtil.closeFile(revIS); } } } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } finally { SVNFileUtil.closeFile(packFileOS); SVNFileUtil.closeFile(manifestFileOS); } }
private void loadOffsets(FSFile file, long itemIndex) throws SVNException { if (myRootOffset >= 0 && itemIndex == FSID.ITEM_INDEX_ROOT_NODE) { return; } if (myChangesOffset >= 0 && itemIndex == FSID.ITEM_INDEX_CHANGES) { return; } long[] rootOffset = { -1 }; long[] changesOffset = { -1 }; if (isUseLogAddressing()) { FSRepositoryUtil.loadRootChangesOffsetLogicalAddressing(getOwner(), getRevision(), file, itemIndex, rootOffset, changesOffset); if (itemIndex == FSID.ITEM_INDEX_ROOT_NODE) { myRootOffset = rootOffset[0]; } if (itemIndex == FSID.ITEM_INDEX_CHANGES) { myChangesOffset = changesOffset[0]; } } else { FSRepositoryUtil.loadRootChangesOffset(getOwner(), getRevision(), file, rootOffset, changesOffset); myRootOffset = rootOffset[0]; myChangesOffset = changesOffset[0]; } }
private static void deltifyProperties(FSFS fsfs, ISVNEditor editor, FSRevisionRoot srcRoot, FSRevisionRoot tgtRoot, String srcPath, String tgtPath, String editPath, boolean isDir) throws SVNException { FSRevisionNode targetNode = tgtRoot.getRevisionNode(tgtPath); SVNProperties sourceProps = null; if (srcPath != null) { FSRevisionNode sourceNode = srcRoot.getRevisionNode(srcPath); boolean propsChanged = !FSRepositoryUtil.arePropertiesEqual(sourceNode, targetNode); if (!propsChanged) { return; } sourceProps = sourceNode.getProperties(fsfs); } else { sourceProps = new SVNProperties(); } SVNProperties targetProps = targetNode.getProperties(fsfs); SVNProperties propsDiffs = FSRepositoryUtil.getPropsDiffs(sourceProps, targetProps); Object[] names = propsDiffs.nameSet().toArray(); for (int i = 0; i < names.length; i++) { String propName = (String) names[i]; SVNPropertyValue propValue = propsDiffs.getSVNPropertyValue(propName); if (isDir) { editor.changeDirProperty(propName, propValue); } else { editor.changeFileProperty(editPath, propName, propValue); } } }
writeDumpData(SVNAdminHelper.DUMPFILE_NODE_ACTION + ": change\n"); compareRoot = myFSFS.createRevisionRoot(compareRevision); mustDumpProps = FSRepositoryUtil.arePropertiesChanged(compareRoot, comparePath, myRoot, canonicalPath); if (kind == SVNNodeKind.FILE) { mustDumpText = FSRepositoryUtil.areFileContentsChanged(compareRoot, comparePath, myRoot, canonicalPath); writeDumpData(SVNAdminHelper.DUMPFILE_NODE_COPYFROM_PATH + ": " + cmpPath + "\n"); compareRoot = myFSFS.createRevisionRoot(compareRevision); mustDumpProps = FSRepositoryUtil.arePropertiesChanged(compareRoot, comparePath, myRoot, canonicalPath); if (kind == SVNNodeKind.FILE) { mustDumpText = FSRepositoryUtil.areFileContentsChanged(compareRoot, comparePath, myRoot, canonicalPath); FSRevisionNode revNode = compareRoot.getRevisionNode(comparePath); FSRepositoryUtil.copy(source, myDumpStream, null); } finally { SVNFileUtil.closeFile(source);
FSRevisionNode fileNode = root.getRevisionNode(pathRevision.getPath()); SVNProperties props = fileNode.getProperties(myFSFS); SVNProperties propDiffs = FSRepositoryUtil.getPropsDiffs(sendBaton.myLastProps, props); boolean contentsChanged = false; if (sendBaton.myLastRoot != null) { contentsChanged = FSRepositoryUtil.areFileContentsChanged(sendBaton.myLastRoot, sendBaton.myLastPath, root, pathRevision.getPath()); } else {
try { revFile = myOwner.getPackOrRevisionFSFile(rev); FSRepositoryUtil.loadRootChangesOffset(myOwner, rev, revFile, rootOffset, null); findMaxIDs(rev, revFile, rootOffset[0], maxNodeID, maxCopyID); } finally { nextNodeID = FSRepositoryUtil.generateNextKey(maxNodeID[0]); nextCopyID = FSRepositoryUtil.generateNextKey(maxCopyID[0]);
SVNProperties propDiff = FSRepositoryUtil.getPropsDiffs(oldProps, newProps); for (Iterator propNames = propDiff.nameSet().iterator(); propNames.hasNext();) { String propName = (String) propNames.next();
public String reserveCopyId(String txnId) throws SVNException { String[] nextIds = myTxnRoot.readNextIDs(); String copyId = FSRepositoryUtil.generateNextKey(nextIds[1]); myFSFS.writeNextIDs(txnId, nextIds[0], copyId); return "_" + nextIds[1]; }
private static void deltifyFiles(FSFS fsfs, ISVNEditor editor, FSRevisionRoot srcRoot, FSRevisionRoot tgtRoot, String srcPath, String tgtPath, String editPath) throws SVNException { deltifyProperties(fsfs, editor, srcRoot, tgtRoot, srcPath, tgtPath, editPath, false); boolean changed = false; if (srcPath != null) { changed = FSRepositoryUtil.areFileContentsChanged(srcRoot, srcPath, tgtRoot, tgtPath); } if (changed) { String srcHexDigest = null; if (srcPath != null) { FSRevisionNode srcNode = srcRoot.getRevisionNode(srcPath); srcHexDigest = srcNode.getFileMD5Checksum(); } editor.applyTextDelta(editPath, srcHexDigest); editor.textDeltaChunk(editPath, SVNDiffWindow.EMPTY); } }
public void openDB() throws SVNException { int format = readDBFormat(); FSRepositoryUtil.checkReposDBFormat(format);
private void loadOffsets(FSFile file) throws SVNException { if (myRootOffset >= 0) { return; } long[] rootOffset = { -1 }; long[] changesOffset = { -1 }; FSRepositoryUtil.loadRootChangesOffset(getOwner(), getRevision(), file, rootOffset, changesOffset); myRootOffset = rootOffset[0]; myChangesOffset = changesOffset[0]; }
private static void deltifyProperties(FSFS fsfs, ISVNEditor editor, FSRevisionRoot srcRoot, FSRevisionRoot tgtRoot, String srcPath, String tgtPath, String editPath, boolean isDir) throws SVNException { FSRevisionNode targetNode = tgtRoot.getRevisionNode(tgtPath); SVNProperties sourceProps = null; if (srcPath != null) { FSRevisionNode sourceNode = srcRoot.getRevisionNode(srcPath); boolean propsChanged = !FSRepositoryUtil.arePropertiesEqual(sourceNode, targetNode); if (!propsChanged) { return; } sourceProps = sourceNode.getProperties(fsfs); } else { sourceProps = new SVNProperties(); } SVNProperties targetProps = targetNode.getProperties(fsfs); SVNProperties propsDiffs = FSRepositoryUtil.getPropsDiffs(sourceProps, targetProps); Object[] names = propsDiffs.nameSet().toArray(); for (int i = 0; i < names.length; i++) { String propName = (String) names[i]; SVNPropertyValue propValue = propsDiffs.getSVNPropertyValue(propName); if (isDir) { editor.changeDirProperty(propName, propValue); } else { editor.changeFileProperty(editPath, propName, propValue); } } }
writeDumpData(SVNAdminHelper.DUMPFILE_NODE_ACTION + ": change\n"); compareRoot = myFSFS.createRevisionRoot(compareRevision); mustDumpProps = FSRepositoryUtil.arePropertiesChanged(compareRoot, comparePath, myRoot, canonicalPath); if (kind == SVNNodeKind.FILE) { mustDumpText = FSRepositoryUtil.areFileContentsChanged(compareRoot, comparePath, myRoot, canonicalPath); writeDumpData(SVNAdminHelper.DUMPFILE_NODE_COPYFROM_PATH + ": " + cmpPath + "\n"); compareRoot = myFSFS.createRevisionRoot(compareRevision); mustDumpProps = FSRepositoryUtil.arePropertiesChanged(compareRoot, comparePath, myRoot, canonicalPath); if (kind == SVNNodeKind.FILE) { mustDumpText = FSRepositoryUtil.areFileContentsChanged(compareRoot, comparePath, myRoot, canonicalPath); FSRevisionNode revNode = compareRoot.getRevisionNode(comparePath); FSRepositoryUtil.copy(source, myDumpStream, null); } finally { SVNFileUtil.closeFile(source);
FSRevisionNode fileNode = root.getRevisionNode(pathRevision.getPath()); SVNProperties props = fileNode.getProperties(myFSFS); SVNProperties propDiffs = FSRepositoryUtil.getPropsDiffs(sendBaton.myLastProps, props); boolean contentsChanged = false; if (sendBaton.myLastRoot != null) { contentsChanged = FSRepositoryUtil.areFileContentsChanged(sendBaton.myLastRoot, sendBaton.myLastPath, root, pathRevision.getPath()); } else {
try { revFile = myOwner.getPackOrRevisionFSFile(rev); FSRepositoryUtil.loadRootChangesOffset(myOwner, rev, revFile, rootOffset, null); findMaxIDs(rev, revFile, rootOffset[0], maxNodeID, maxCopyID); } finally { nextNodeID = FSRepositoryUtil.generateNextKey(maxNodeID[0]); nextCopyID = FSRepositoryUtil.generateNextKey(maxCopyID[0]);
SVNProperties propDiff = FSRepositoryUtil.getPropsDiffs(oldProps, newProps); for (Iterator propNames = propDiff.nameSet().iterator(); propNames.hasNext();) { String propName = (String) propNames.next();
public String reserveCopyId(String txnId) throws SVNException { String[] nextIds = myTxnRoot.readNextIDs(); String copyId = FSRepositoryUtil.generateNextKey(nextIds[1]); myFSFS.writeNextIDs(txnId, nextIds[0], copyId); return "_" + nextIds[1]; }
private static void deltifyFiles(FSFS fsfs, ISVNEditor editor, FSRevisionRoot srcRoot, FSRevisionRoot tgtRoot, String srcPath, String tgtPath, String editPath) throws SVNException { deltifyProperties(fsfs, editor, srcRoot, tgtRoot, srcPath, tgtPath, editPath, false); boolean changed = false; if (srcPath != null) { changed = FSRepositoryUtil.areFileContentsChanged(srcRoot, srcPath, tgtRoot, tgtPath); } if (changed) { String srcHexDigest = null; if (srcPath != null) { FSRevisionNode srcNode = srcRoot.getRevisionNode(srcPath); srcHexDigest = srcNode.getFileMD5Checksum(); } editor.applyTextDelta(editPath, srcHexDigest); editor.textDeltaChunk(editPath, SVNDiffWindow.EMPTY); } }