private SVNDirEntry buildDirEntry(FSEntry repEntry, SVNURL parentURL, FSRevisionNode entryNode, boolean includeLogs) throws SVNException { entryNode = entryNode == null ? myFSFS.getRevisionNode(repEntry.getId()) : entryNode; long size = 0; if (entryNode.getType() == SVNNodeKind.FILE) { size = entryNode.getFileLength(); } Map props = null; props = entryNode.getProperties(myFSFS); boolean hasProps = (props == null || props.size() == 0) ? false : true; Map revProps = null; revProps = myFSFS.getRevisionProperties(repEntry.getId().getRevision()); String lastAuthor = null; String log = null; Date lastCommitDate = null; if (revProps != null && revProps.size() > 0) { lastAuthor = (String) revProps.get(SVNRevisionProperty.AUTHOR); log = (String) revProps.get(SVNRevisionProperty.LOG); String timeString = (String) revProps.get(SVNRevisionProperty.DATE); lastCommitDate = timeString != null ? SVNTimeUtil.parseDateString(timeString) : null; } SVNURL entryURL = parentURL.appendPath(repEntry.getName(), false); SVNDirEntry dirEntry = new SVNDirEntry(entryURL, repEntry.getName(), repEntry.getType(), size, hasProps, repEntry.getId().getRevision(), lastCommitDate, lastAuthor, includeLogs ? log : null); dirEntry.setRelativePath(repEntry.getName()); return dirEntry; }
private FSEntry parseRepEntryValue(String name, String value) { if (value == null) { return null; } int spaceInd = value.indexOf(' '); if (spaceInd == -1) { return null; } String kind = value.substring(0, spaceInd); String rawID = value.substring(spaceInd + 1); SVNNodeKind type = SVNNodeKind.parseKind(kind); FSID id = FSID.fromString(rawID); if ((type != SVNNodeKind.DIR && type != SVNNodeKind.FILE) || id == null) { return null; } return new FSEntry(id, type, name); }
public Map unparseDirEntries(Map entries) { Map unparsedEntries = new HashMap(); for (Iterator names = entries.keySet().iterator(); names.hasNext();) { String name = (String) names.next(); FSEntry dirEntry = (FSEntry) entries.get(name); String unparsedVal = dirEntry.toString(); unparsedEntries.put(name, unparsedVal); } return unparsedEntries; }
public int compare(Object o1, Object o2) { FSEntry e1 = (FSEntry) o1; FSEntry e2 = (FSEntry) o2; if (srcMap != null) { boolean has1Src = srcMap.containsKey(e1.getName()); boolean has2Src = srcMap.containsKey(e2.getName()); if (has1Src != has2Src) { return has1Src ? 1 : -1; } } return e1.compareTo(e2); } });
String entryName = (String) entryNames.next(); FSEntry entry = (FSEntry) entries.get(entryName); String newPath = SVNPathUtil.append(path, entry.getName()); if (entry.getType() == SVNNodeKind.DIR) { addSubdirectory(srcRoot, tgtRoot, editor, SVNPathUtil.append(srcPath, entry.getName()), newPath); editor.closeDir(); } else if (entry.getType() == SVNNodeKind.FILE) { editor.addFile(SVNPathUtil.append(path, entry.getName()), null, -1); String newSrcPath = SVNPathUtil.append(srcPath, entry.getName()); FSRevisionNode srcNode = srcRoot.getRevisionNode(newSrcPath);
if (!recursive && ((sourceEntry != null && sourceEntry.getType() == SVNNodeKind.DIR) || (targetEntry != null && targetEntry.getType() == SVNNodeKind.DIR))) { skipPathInfo(editPath); return; if (sourceEntry != null && targetEntry != null && sourceEntry.getType() == targetEntry.getType()) { int distance = sourceEntry.getId().compareTo(targetEntry.getId()); if (distance == 0 && !PathInfo.isRelevant(getCurrentPathInfo(), editPath) && (pathInfo == null || (!pathInfo.isStartEmpty() && pathInfo.getLockToken() == null))) { return; if (targetEntry.getType() == SVNNodeKind.DIR) { if (related) { getEditor().openDir(editPath, sourceRevision);
for (Iterator entries = namesToEntries.values().iterator(); entries.hasNext();) { FSEntry dirEntry = (FSEntry) entries.next(); newId = writeFinalRevision(newId, protoFile, revision, dirEntry.getId(), startNodeId, startCopyId); if (newId != null && newId.getRevision() == revision) { dirEntry.setId(newId);
private void deleteEntryIfMutable(FSID id) throws SVNException { FSRevisionNode node = getOwner().getRevisionNode(id); if (!node.getId().isTxn()) { return; } if (node.getType() == SVNNodeKind.DIR) { Map entries = node.getDirEntries(getOwner()); for (Iterator names = entries.keySet().iterator(); names.hasNext();) { String name = (String) names.next(); FSEntry entry = (FSEntry) entries.get(name); deleteEntryIfMutable(entry.getId()); } } removeRevisionNode(id); }
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; }
if ("".equals(getReportTarget()) && (sourceEntry == null || sourceEntry.getType() != SVNNodeKind.DIR || targetEntry == null || targetEntry.getType() != SVNNodeKind.DIR)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Cannot replace a directory from within"); SVNErrorManager.error(err);
String entryName = (String) entryNames.next(); FSEntry entry = (FSEntry) entries.get(entryName); String newPath = SVNPathUtil.append(path, entry.getName()); if (entry.getType() == SVNNodeKind.DIR) { addSubdirectory(srcRoot, tgtRoot, editor, SVNPathUtil.append(srcPath, entry.getName()), newPath); editor.closeDir(); } else if (entry.getType() == SVNNodeKind.FILE) { editor.addFile(SVNPathUtil.append(path, entry.getName()), null, -1); String newSrcPath = SVNPathUtil.append(srcPath, entry.getName()); FSRevisionNode srcNode = srcRoot.getRevisionNode(newSrcPath);
if (sourceEntry != null && targetEntry != null && sourceEntry.getType() == targetEntry.getType()) { int distance = sourceEntry.getId().compareTo(targetEntry.getId()); if (distance == 0 && !PathInfo.isRelevant(getCurrentPathInfo(), editPath) && (pathInfo == null || (!pathInfo.isStartEmpty() && pathInfo.getLockToken() == null)) && (requestedDepth.compareTo(wcDepth) <= 0 || targetEntry.getType() == SVNNodeKind.FILE)) { return; } else if (distance != -1 || isIgnoreAncestry()) { if (targetEntry.getType() == SVNNodeKind.DIR) { if (related) { getEditor().openDir(editPath, sourceRevision);
for (Iterator entries = namesToEntries.values().iterator(); entries.hasNext();) { FSEntry dirEntry = (FSEntry) entries.next(); newId = writeFinalRevision(newId, protoFile, revision, dirEntry.getId(), startNodeId, startCopyId); if (newId != null && newId.getRevision() == revision) { dirEntry.setId(newId);
private void deleteEntryIfMutable(FSID id) throws SVNException { FSRevisionNode node = getOwner().getRevisionNode(id); if (!node.getId().isTxn()) { return; } if (node.getType() == SVNNodeKind.DIR) { Map entries = node.getDirEntries(getOwner()); for (Iterator names = entries.keySet().iterator(); names.hasNext();) { String name = (String) names.next(); FSEntry entry = (FSEntry) entries.get(name); deleteEntryIfMutable(entry.getId()); } } removeRevisionNode(id); }
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; }
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Target path ''{0}'' does not exist", getReportTargetPath()); SVNErrorManager.error(err, SVNLogType.FSFS); } else if ("".equals(getReportTarget()) && (sourceEntry == null || sourceEntry.getType() != SVNNodeKind.DIR || targetEntry.getType() != SVNNodeKind.DIR)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_PATH_SYNTAX, "Cannot replace a directory from within"); SVNErrorManager.error(err, SVNLogType.FSFS);
private void getTree(FSFS fsfs, FSRoot root, String path, SVNNodeKind kind, FSID id, boolean includeIDs, int depth, boolean recursive, ISVNTreeHandler handler) throws SVNException { checkCancelled(); if (handler != null) { handler.handlePath(new SVNAdminPath(path, includeIDs ? id.toString() : null, depth, kind == SVNNodeKind.DIR)); } if (kind != SVNNodeKind.DIR) { return; } if (recursive || depth == 0) { FSRevisionNode node = root.getRevisionNode(path); Map entries = node.getDirEntries(fsfs); for (Iterator names = entries.keySet().iterator(); names.hasNext();) { String name = (String) names.next(); FSEntry entry = (FSEntry) entries.get(name); getTree(fsfs, root, SVNPathUtil.getAbsolutePath(SVNPathUtil.append(path, entry.getName())), entry.getType(), includeIDs ? entry.getId() : null, includeIDs, depth + 1, recursive, handler); } } }
String entryName = (String) entryNames.next(); FSEntry entry = (FSEntry) entries.get(entryName); String newPath = SVNPathUtil.append(path, entry.getName()); if (entry.getType() == SVNNodeKind.DIR) { addSubdirectory(srcRoot, tgtRoot, editor, SVNPathUtil.append(srcPath, entry.getName()), newPath); editor.closeDir(); } else if (entry.getType() == SVNNodeKind.FILE) { editor.addFile(SVNPathUtil.append(path, entry.getName()), null, -1); String newSrcPath = SVNPathUtil.append(srcPath, entry.getName()); FSRevisionNode srcNode = srcRoot.getRevisionNode(newSrcPath);
if (sourceEntry != null && targetEntry != null && sourceEntry.getType() == targetEntry.getType()) { int distance = sourceEntry.getId().compareTo(targetEntry.getId()); if (distance == 0 && !PathInfo.isRelevant(getCurrentPathInfo(), editPath) && (pathInfo == null || (!pathInfo.isStartEmpty() && pathInfo.getLockToken() == null)) && (requestedDepth.compareTo(wcDepth) <= 0 || targetEntry.getType() == SVNNodeKind.FILE)) { return; } else if (distance != -1 || isIgnoreAncestry()) { if (targetEntry.getType() == SVNNodeKind.DIR) { if (related) { getEditor().openDir(editPath, sourceRevision);
private FSEntry parseRepEntryValue(String name, String value) { if (value == null) { return null; } int spaceInd = value.indexOf(' '); if (spaceInd == -1) { return null; } String kind = value.substring(0, spaceInd); String rawID = value.substring(spaceInd + 1); SVNNodeKind type = SVNNodeKind.parseKind(kind); FSID id = FSID.fromString(rawID); if ((type != SVNNodeKind.DIR && type != SVNNodeKind.FILE) || id == null) { return null; } return new FSEntry(id, type, name); }