private FSEntry fakeDirEntry(String reposPath, FSRevisionRoot root) throws SVNException { if (root.checkNodeKind(reposPath) == SVNNodeKind.NONE) { return null; } FSRevisionNode node = root.getRevisionNode(reposPath); FSEntry dirEntry = new FSEntry(node.getId(), node.getType(), SVNPathUtil.tail(node.getCreatedPath())); return dirEntry; }
private void doResources(FSRevisionRoot root, StringBuffer buffer) throws SVNException { Map changedPaths = root.getChangedPaths(); Map sentPaths = new HashMap(); for (Iterator pathsIter = changedPaths.keySet().iterator(); pathsIter.hasNext();) { SVNNodeKind pathKind = root.checkNodeKind(path); sendResponse(root, path, pathKind == SVNNodeKind.DIR, buffer); sentPaths.put(path, path);
public Map getChangedPaths() throws SVNException { FSFile file = getOwner().getPackOrRevisionFSFile(getRevision()); try { loadOffsets(file, FSID.ITEM_INDEX_CHANGES); file.seek(myChangesOffset); return fetchAllChanges(file, true); } finally { file.close(); } }
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 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]; } }
InputStream fileStream = null; try { fileStream = root.getFileStreamForPath(new SVNDeltaCombiner(), repositoryPath); byte[] buffer = new byte[102400]; while (true) { FSRevisionNode revNode = root.getRevisionNode(repositoryPath); properties.putAll(collectProperties(revNode));
public FSNodeHistory getNodeHistory(String path) throws SVNException { SVNNodeKind kind = checkNodeKind(path); if (kind == SVNNodeKind.NONE) { SVNErrorManager.error(FSErrors.errorNotFound(this, path), SVNLogType.FSFS); } return new FSNodeHistory(new SVNLocationEntry(getRevision(), SVNPathUtil.canonicalizeAbsolutePath(path)), false, new SVNLocationEntry(SVNRepository.INVALID_REVISION, null), getOwner()); }
private static void replaceFileOrDir(FSFS fsfs, ISVNEditor editor, FSRevisionRoot srcRoot, FSRevisionRoot tgtRoot, String srcPath, String tgtPath, String editPath, SVNNodeKind tgtKind) throws SVNException { long baseRevision = srcRoot.getRevision(); if (tgtKind == SVNNodeKind.DIR) { editor.openDir(editPath, baseRevision); deltifyDirs(fsfs, editor, srcRoot, tgtRoot, srcPath, tgtPath, editPath); editor.closeDir(); } else { editor.openFile(editPath, baseRevision); deltifyFiles(fsfs, editor, srcRoot, tgtRoot, srcPath, tgtPath, editPath); FSRevisionNode tgtNode = tgtRoot.getRevisionNode(tgtPath); editor.closeFile(editPath, tgtNode.getFileMD5Checksum()); } }
public FSRevisionNode getRootRevisionNode() throws SVNException { if (myRootRevisionNode == null) { FSFile file = getOwner().getRevisionFile(getRevision()); try { loadOffsets(file); file.seek(myRootOffset); Map headers = file.readHeader(); myRootRevisionNode = FSRevisionNode.fromMap(headers); } finally { file.close(); } } return myRootRevisionNode; }
public FSClosestCopy getClosestCopy(String path) throws SVNException { FSParentPath parentPath = openPath(path, true, true); SVNLocationEntry copyDstEntry = FSNodeHistory.findYoungestCopyroot(getOwner().getRepositoryRoot(), parentPath); if (copyDstEntry == null || copyDstEntry.getRevision() == 0) { return null; } FSRevisionRoot copyDstRoot = getOwner().createRevisionRoot(copyDstEntry.getRevision()); if (copyDstRoot.checkNodeKind(path) == SVNNodeKind.NONE) { return null; } FSParentPath copyDstParentPath = copyDstRoot.openPath(path, true, true); FSRevisionNode copyDstNode = copyDstParentPath.getRevNode(); if (!copyDstNode.getId().isRelated(parentPath.getRevNode().getId())) { return null; } long createdRev = copyDstNode.getCreatedRevision(); if (createdRev == copyDstEntry.getRevision()) { if (copyDstNode.getPredecessorId() == null) { return null; } } return new FSClosestCopy(copyDstRoot, copyDstEntry.getPath()); }
public static long getSafeCreatedRevision(FSRevisionRoot root, String path) { long revision = root.getRevision(); FSFS fsfs = root.getOwner(); FSID id = null; try { FSRevisionNode node = root.getRevisionNode(path); id = node.getId(); } catch (SVNException svne) { long historyRev = -1; try { history = root.getNodeHistory(path); history = history.getPreviousHistory(false); historyRev = history.getHistoryEntry().getRevision(); FSRevisionNode node = otherRoot.getRevisionNode(path); otherID = node.getId(); } catch (SVNException svne) {
public FSRevisionNode getRootRevisionNode() throws SVNException { if (myRootRevisionNode == null) { if (false && isUseLogAddressing()) { FSRevisionNode rootRevisionNode = new FSRevisionNode(); rootRevisionNode.setId(FSID.createRevId(null, null, myRevision, FSID.ITEM_INDEX_ROOT_NODE)); rootRevisionNode.setType(SVNNodeKind.DIR); rootRevisionNode.setPredecessorId(null); rootRevisionNode.setCreatedPath("/"); myRootRevisionNode = rootRevisionNode; } else { FSFile file = getOwner().getPackOrRevisionFSFile(getRevision()); try { loadOffsets(file, FSID.ITEM_INDEX_ROOT_NODE); file.seek(myRootOffset); Map headers = file.readHeader(); myRootRevisionNode = FSRevisionNode.fromMap(headers); } finally { file.close(); } } } return myRootRevisionNode; }
private void addDescendantMergeInfo(Map result, FSRevisionRoot root, String path) throws SVNException { FSRevisionNode node = root.getRevisionNode(path); if (node.hasDescendantsWithMergeInfo()) { crawlDirectoryForMergeInfo(root, path, node, result); } }
Map changedPaths = root.getChangedPaths(); if (changedPaths == null || changedPaths.isEmpty()) { return; if (basePath != null && baseRevision >= 0) { baseRoot = myFSFS.createRevisionRoot(baseRevision); SVNProperties props = myFSFS.getProperties(baseRoot.getRevisionNode(basePath)); previousMergeInfoValue = props.getStringValue(SVNProperty.MERGE_INFO); SVNProperties props = myFSFS.getProperties(root.getRevisionNode(changedPath)); if (props != null) { mergeInfoValue = props.getStringValue(SVNProperty.MERGE_INFO);
boolean markAsMerged, Map duplicatePathRevs) throws SVNException { FSRevisionRoot root = myFSFS.createRevisionRoot(endRevision); if (root.checkNodeKind(path) != SVNNodeKind.FILE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "''{0}'' is not a file in revision ''{1}''", FSNodeHistory history = root.getNodeHistory(path); while (true) { history = history.getPreviousHistory(true);
FSNodeHistory history = root.getNodeHistory(path); long count = 0; do { if (includeIDs) { FSRevisionRoot revRoot = fsfs.createRevisionRoot(revision); FSRevisionNode node = revRoot.getRevisionNode(history.getHistoryEntry().getPath()); id = node.getId().toString();
FSRevisionRoot root = myFSFS.createRevisionRoot(endRevision); if (root.checkNodeKind(path) != SVNNodeKind.FILE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "''{0}'' is not a file", path); SVNErrorManager.error(err); FSRevisionNode fileNode = root.getRevisionNode(revPath); Map props = fileNode.getProperties(myFSFS); Map propDiffs = getPropsDiffs(props, lastProps); sourceStream = FSInputStream.createDeltaStream(sourceCombiner, (FSRevisionNode) null, myFSFS); targetStream = root.getFileStreamForPath(targetCombiner, revPath); SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator(); deltaGenerator.sendDelta(path, sourceStream, 0, targetStream, handler, false);
private Map crawlDirectoryForMergeInfo(FSRevisionRoot root, String path, FSRevisionNode node, Map result) throws SVNException { FSFS fsfs = root.getOwner(); Map entries = node.getDirEntries(fsfs); for (Iterator entriesIter = entries.values().iterator(); entriesIter.hasNext();) { FSEntry entry = (FSEntry) entriesIter.next(); String kidPath = SVNPathUtil.getAbsolutePath(SVNPathUtil.append(path, entry.getName())); FSRevisionNode kidNode = root.getRevisionNode(kidPath); if (kidNode.hasMergeInfo()) { SVNProperties propList = kidNode.getProperties(fsfs); String mergeInfoString = propList.getStringValue(SVNProperty.MERGE_INFO); if (mergeInfoString == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Node-revision #''{0}'' claims to have mergeinfo but doesn''t", entry.getId()); SVNErrorManager.error(err, SVNLogType.FSFS); } Map kidMergeInfo = SVNMergeInfoUtil.parseMergeInfo(new StringBuffer(mergeInfoString), null); result.put(kidPath, kidMergeInfo); } if (kidNode.hasDescendantsWithMergeInfo()) { crawlDirectoryForMergeInfo(root, kidPath, kidNode, result); } } return result; }
openRepository(); FSRevisionRoot root = myFSFS.createRevisionRoot(highRevision); Map fsChanges = root.getChangedPaths(); String basePath = getRepositoryPath(""); compareRoot = myFSFS.createRevisionRoot(root.getRevision() - 1); editor.targetRevision(root.getRevision());
private PathInfo[] getPathHistories(String[] paths, long start, long end, boolean strictNodeHistory) throws SVNException { PathInfo[] histories = new PathInfo[paths.length]; FSRevisionRoot root = myFSFS.createRevisionRoot(end); for (int i = 0; i < paths.length; i++) { String path = paths[i]; PathInfo pathHistory = new PathInfo(); pathHistory.myPath = path; pathHistory.myHistoryRevision = end; pathHistory.myIsDone = false; pathHistory.myIsFirstTime = true; if (i < MAX_OPEN_HISTORIES) { pathHistory.myHistory = root.getNodeHistory(path); } histories[i] = pathHistory.getHistory(strictNodeHistory, start); } return histories; }