private Map collectProperties(FSRevisionNode revNode) throws SVNException { Map properties = new HashMap(); Map versionedProps = revNode.getProperties(myFSFS); if (versionedProps != null && versionedProps.size() > 0) { properties.putAll(versionedProps); } Map metaprops = null; try { metaprops = myFSFS.compoundMetaProperties(revNode.getId().getRevision()); } catch (SVNException svne) { // } if (metaprops != null && metaprops.size() > 0) { properties.putAll(metaprops); } return properties; }
public void removeNodeProperties() throws SVNException { FSTransactionRoot txnRoot = myCurrentRevisionBaton.myTxnRoot; FSRevisionNode node = txnRoot.getRevisionNode(myCurrentNodeBaton.myPath); SVNProperties props = node.getProperties(myFSFS); for (Iterator propNames = props.nameSet().iterator(); propNames.hasNext();) { String propName = (String) propNames.next(); myCurrentRevisionBaton.getCommitter().changeNodeProperty(myCurrentNodeBaton.myPath, propName, null); } }
public void removeNodeProperties() throws SVNException { FSTransactionRoot txnRoot = myCurrentRevisionBaton.myTxnRoot; FSRevisionNode node = txnRoot.getRevisionNode(myCurrentNodeBaton.myPath); SVNProperties props = node.getProperties(myFSFS); for (Iterator propNames = props.nameSet().iterator(); propNames.hasNext();) { String propName = (String) propNames.next(); myCurrentRevisionBaton.getCommitter().changeNodeProperty(myCurrentNodeBaton.myPath, propName, null); } }
public void removeNodeProperties() throws SVNException { FSTransactionRoot txnRoot = myCurrentRevisionBaton.myTxnRoot; FSRevisionNode node = txnRoot.getRevisionNode(myCurrentNodeBaton.myPath); SVNProperties props = node.getProperties(myFSFS); for (Iterator propNames = props.nameSet().iterator(); propNames.hasNext();) { String propName = (String) propNames.next(); myCurrentRevisionBaton.getCommitter().changeNodeProperty(myCurrentNodeBaton.myPath, propName, null); } }
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); } } }
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); } } }
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); } } }
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; }
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; }
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; }
private void changeNodeProperty(String path, String propName, String propValue) throws SVNException { if (!SVNProperty.isRegularProperty(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.REPOS_BAD_ARGS, "Storage of non-regular property ''{0}'' is disallowed through the repository interface, and could indicate a bug in your client", propName); SVNErrorManager.error(err); } FSParentPath parentPath = myTxnRoot.openPath(path, true, true); if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, false, false); } myCommitter.makePathMutable(parentPath, path); Map properties = parentPath.getRevNode().getProperties(myFSFS); if (properties.isEmpty() && propValue == null) { return; } if (propValue == null) { properties.remove(propName); } else { properties.put(propName, propValue); } myTxnRoot.setProplist(parentPath.getRevNode(), properties); myCommitter.addChange(path, parentPath.getRevNode().getId(), FSPathChangeKind.FS_PATH_CHANGE_MODIFY, false, true, FSRepository.SVN_INVALID_REVNUM, null); }
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 SVNProperties collectProperties(FSRevisionNode revNode) throws SVNException { SVNProperties properties = new SVNProperties(); SVNProperties versionedProps = revNode.getProperties(myFSFS); if (versionedProps != null && versionedProps.size() > 0) { properties.putAll(versionedProps); } SVNProperties metaprops = null; try { metaprops = myFSFS.compoundMetaProperties(revNode.getCreatedRevision()); } catch (SVNException svne) { // } if (metaprops != null && metaprops.size() > 0) { properties.putAll(metaprops); } return properties; }
private SVNProperties collectProperties(FSRevisionNode revNode) throws SVNException { SVNProperties properties = new SVNProperties(); SVNProperties versionedProps = revNode.getProperties(myFSFS); if (versionedProps != null && versionedProps.size() > 0) { properties.putAll(versionedProps); } SVNProperties metaprops = null; try { metaprops = myFSFS.compoundMetaProperties(revNode.getCreatedRevision()); } catch (SVNException svne) { // } if (metaprops != null && metaprops.size() > 0) { properties.putAll(metaprops); } return properties; }
private SVNProperties collectProperties(FSRevisionNode revNode) throws SVNException { SVNProperties properties = new SVNProperties(); SVNProperties versionedProps = revNode.getProperties(myFSFS); if (versionedProps != null && versionedProps.size() > 0) { properties.putAll(versionedProps); } SVNProperties metaprops = null; try { metaprops = myFSFS.compoundMetaProperties(revNode.getCreatedRevision()); } catch (SVNException svne) { // } if (metaprops != null && metaprops.size() > 0) { properties.putAll(metaprops); } return properties; }
private DiffItem prepareTmpFile(FSRoot root, String path, ISVNDiffGenerator generator) throws SVNException { String mimeType = null; if (root != null) { FSRevisionNode node = root.getRevisionNode(path); SVNProperties nodeProps = node.getProperties(root.getOwner()); mimeType = nodeProps.getStringValue(SVNProperty.MIME_TYPE); if (SVNProperty.isBinaryMimeType(mimeType) && !generator.isForcedBinaryDiff()) { return new DiffItem(mimeType, null); } } File tmpFile = createTempFile(generator); if (root != null) { InputStream contents = null; OutputStream tmpOS = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); tmpOS = SVNFileUtil.openFileForWriting(tmpFile); FSRepositoryUtil.copy(contents, tmpOS, myCancelHandler); } finally { SVNFileUtil.closeFile(contents); SVNFileUtil.closeFile(tmpOS); } } return new DiffItem(mimeType, tmpFile); }
private DiffItem prepareTmpFile(FSRoot root, String path, ISVNDiffGenerator generator) throws SVNException { String mimeType = null; if (root != null) { FSRevisionNode node = root.getRevisionNode(path); SVNProperties nodeProps = node.getProperties(root.getOwner()); mimeType = nodeProps.getStringValue(SVNProperty.MIME_TYPE); if (SVNProperty.isBinaryMimeType(mimeType) && !generator.isForcedBinaryDiff()) { return new DiffItem(mimeType, null); } } File tmpFile = createTempFile(generator); if (root != null) { InputStream contents = null; OutputStream tmpOS = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); tmpOS = SVNFileUtil.openFileForWriting(tmpFile); FSRepositoryUtil.copy(contents, tmpOS, myCancelHandler); } finally { SVNFileUtil.closeFile(contents); SVNFileUtil.closeFile(tmpOS); } } return new DiffItem(mimeType, tmpFile); }
private DiffItem prepareTmpFile(FSRoot root, String path, ISVNDiffGenerator generator) throws SVNException { String mimeType = null; if (root != null) { FSRevisionNode node = root.getRevisionNode(path); SVNProperties nodeProps = node.getProperties(root.getOwner()); mimeType = nodeProps.getStringValue(SVNProperty.MIME_TYPE); if (SVNProperty.isBinaryMimeType(mimeType) && !generator.isForcedBinaryDiff()) { return new DiffItem(mimeType, null); } } File tmpFile = createTempFile(generator); if (root != null) { InputStream contents = null; OutputStream tmpOS = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); tmpOS = SVNFileUtil.openFileForWriting(tmpFile); FSRepositoryUtil.copy(contents, tmpOS, myCancelHandler); } finally { SVNFileUtil.closeFile(contents); SVNFileUtil.closeFile(tmpOS); } } return new DiffItem(mimeType, tmpFile); }
return node.getProperties(fsfs); } finally { SVNAdminHelper.closeRepository(fsfs);
return node.getProperties(fsfs); } finally { SVNAdminHelper.closeRepository(fsfs);