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); }
public void applyText(String path) throws SVNException { String fullPath = SVNPathUtil.getAbsolutePath(SVNPathUtil.append(myBasePath, path)); FSParentPath parentPath = myTxnRoot.openPath(fullPath, true, true); if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { myCommitter.allowLockedOperation(myFSFS, fullPath, myAuthor, myLockTokens, false, false); } myCommitter.makePathMutable(parentPath, fullPath); FSRevisionNode node = parentPath.getRevNode(); InputStream sourceStream = null; OutputStream targetStream = null; int dbFormat = myFSFS.getDBFormat(); try { sourceStream = SVNFileUtil.DUMMY_IN; targetStream = FSOutputStream.createStream(node, myTxnRoot, myTargetStream, dbFormat >= 2); if (myDeltaProcessor == null) { myDeltaProcessor = new SVNDeltaProcessor(); } myDeltaProcessor.applyTextDelta(sourceStream, targetStream, false); } catch (SVNException svne) { throw svne; } finally { myTargetStream = (FSOutputStream) targetStream; } myCommitter.addChange(fullPath, node.getId(), FSPathChangeKind.FS_PATH_CHANGE_MODIFY, true, false, false, SVNRepository.INVALID_REVISION, null, SVNNodeKind.FILE); }
public void applyText(String path) throws SVNException { String fullPath = SVNPathUtil.getAbsolutePath(SVNPathUtil.append(myBasePath, path)); FSParentPath parentPath = myTxnRoot.openPath(fullPath, true, true); if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, fullPath, myAuthor, myLockTokens, false, false); } myCommitter.makePathMutable(parentPath, fullPath); FSRevisionNode node = parentPath.getRevNode(); InputStream sourceStream = null; OutputStream targetStream = null; int dbFormat = myFSFS.getDBFormat(); try { sourceStream = SVNFileUtil.DUMMY_IN; targetStream = FSOutputStream.createStream(node, myTxnRoot, myTargetStream, dbFormat >= 2); if (myDeltaProcessor == null) { myDeltaProcessor = new SVNDeltaProcessor(); } myDeltaProcessor.applyTextDelta(sourceStream, targetStream, false); } catch (SVNException svne) { throw svne; } finally { myTargetStream = (FSOutputStream) targetStream; } myCommitter.addChange(fullPath, node.getId(), FSPathChangeKind.FS_PATH_CHANGE_MODIFY, true, false, SVNRepository.INVALID_REVISION, null, SVNNodeKind.FILE); }
public void applyText(String path) throws SVNException { String fullPath = SVNPathUtil.getAbsolutePath(SVNPathUtil.append(myBasePath, path)); FSParentPath parentPath = myTxnRoot.openPath(fullPath, true, true); if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, fullPath, myAuthor, myLockTokens, false, false); } myCommitter.makePathMutable(parentPath, fullPath); FSRevisionNode node = parentPath.getRevNode(); InputStream sourceStream = null; OutputStream targetStream = null; int dbFormat = myFSFS.getDBFormat(); try { sourceStream = SVNFileUtil.DUMMY_IN; targetStream = FSOutputStream.createStream(node, myTxnRoot, myTargetStream, dbFormat >= 2); if (myDeltaProcessor == null) { myDeltaProcessor = new SVNDeltaProcessor(); } myDeltaProcessor.applyTextDelta(sourceStream, targetStream, false); } catch (SVNException svne) { throw svne; } finally { myTargetStream = (FSOutputStream) targetStream; } myCommitter.addChange(fullPath, node.getId(), FSPathChangeKind.FS_PATH_CHANGE_MODIFY, true, false, SVNRepository.INVALID_REVISION, null, SVNNodeKind.FILE); }
public void deleteNode(String path) throws SVNException { FSParentPath parentPath = myTxnRoot.openPath(path, true, true); if (parentPath.getParent() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ROOT_DIR, "The root directory cannot be deleted"); SVNErrorManager.error(err); } if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, true, false); } makePathMutable(parentPath.getParent(), path); myTxnRoot.deleteEntry(parentPath.getParent().getRevNode(), parentPath.getNameEntry()); myTxnRoot.removeRevNodeFromCache(parentPath.getAbsPath()); addChange(path, parentPath.getRevNode().getId(), FSPathChangeKind.FS_PATH_CHANGE_DELETE, false, false, FSRepository.SVN_INVALID_REVNUM, null); }
public void makeDir(String path) throws SVNException { SVNPathUtil.checkPathIsValid(path); String txnId = myTxnRoot.getTxnID(); FSParentPath parentPath = myTxnRoot.openPath(path, false, true); if (parentPath.getRevNode() != null) { SVNErrorManager.error(FSErrors.errorAlreadyExists(myTxnRoot, path, myFSFS)); } if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, true, false); } makePathMutable(parentPath.getParent(), path); FSRevisionNode subDirNode = makeEntry(parentPath.getParent().getRevNode(), parentPath.getParent().getAbsPath(), parentPath.getNameEntry(), true, txnId); myTxnRoot.putRevNodeToCache(parentPath.getAbsPath(), subDirNode); addChange(path, subDirNode.getId(), FSPathChangeKind.FS_PATH_CHANGE_ADD, false, false, FSRepository.SVN_INVALID_REVNUM, null); }
public void makeDir(String path) throws SVNException { SVNPathUtil.checkPathIsValid(path); String txnId = myTxnRoot.getTxnID(); FSParentPath parentPath = myTxnRoot.openPath(path, false, true); if (parentPath.getRevNode() != null) { SVNErrorManager.error(FSErrors.errorAlreadyExists(myTxnRoot, path, myFSFS), SVNLogType.FSFS); } if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, true, false); } makePathMutable(parentPath.getParent(), path); FSRevisionNode subDirNode = makeEntry(parentPath.getParent().getRevNode(), parentPath.getParent().getAbsPath(), parentPath.getEntryName(), true, txnId); myTxnRoot.putRevNodeToCache(parentPath.getAbsPath(), subDirNode); addChange(path, subDirNode.getId(), FSPathChangeKind.FS_PATH_CHANGE_ADD, false, false, SVNRepository.INVALID_REVISION, null, SVNNodeKind.DIR); }
public void makeFile(String path) throws SVNException { SVNPathUtil.checkPathIsValid(path); String txnId = myTxnRoot.getTxnID(); FSParentPath parentPath = myTxnRoot.openPath(path, false, true); if (parentPath.getRevNode() != null) { SVNErrorManager.error(FSErrors.errorAlreadyExists(myTxnRoot, path, myFSFS)); } if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, false, false); } makePathMutable(parentPath.getParent(), path); FSRevisionNode childNode = makeEntry(parentPath.getParent().getRevNode(), parentPath.getParent().getAbsPath(), parentPath.getNameEntry(), false, txnId); myTxnRoot.putRevNodeToCache(parentPath.getAbsPath(), childNode); addChange(path, childNode.getId(), FSPathChangeKind.FS_PATH_CHANGE_ADD, false, false, FSRepository.SVN_INVALID_REVNUM, null); }
public void makeFile(String path) throws SVNException { SVNPathUtil.checkPathIsValid(path); String txnId = myTxnRoot.getTxnID(); FSParentPath parentPath = myTxnRoot.openPath(path, false, true); if (parentPath.getRevNode() != null) { SVNErrorManager.error(FSErrors.errorAlreadyExists(myTxnRoot, path, myFSFS), SVNLogType.FSFS); } if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, false, false); } makePathMutable(parentPath.getParent(), path); FSRevisionNode childNode = makeEntry(parentPath.getParent().getRevNode(), parentPath.getParent().getAbsPath(), parentPath.getEntryName(), false, txnId); myTxnRoot.putRevNodeToCache(parentPath.getAbsPath(), childNode); addChange(path, childNode.getId(), FSPathChangeKind.FS_PATH_CHANGE_ADD, false, false, SVNRepository.INVALID_REVISION, null, SVNNodeKind.FILE); }
public void makeDir(String path) throws SVNException { SVNPathUtil.checkPathIsValid(path); String txnId = myTxnRoot.getTxnID(); FSParentPath parentPath = myTxnRoot.openPath(path, false, true); if (parentPath.getRevNode() != null) { SVNErrorManager.error(FSErrors.errorAlreadyExists(myTxnRoot, path, myFSFS), SVNLogType.FSFS); } if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, true, false); } makePathMutable(parentPath.getParent(), path); FSRevisionNode subDirNode = makeEntry(parentPath.getParent().getRevNode(), parentPath.getParent().getAbsPath(), parentPath.getEntryName(), true, txnId); myTxnRoot.putRevNodeToCache(parentPath.getAbsPath(), subDirNode); addChange(path, subDirNode.getId(), FSPathChangeKind.FS_PATH_CHANGE_ADD, false, false, SVNRepository.INVALID_REVISION, null, SVNNodeKind.DIR); }
public void makeFile(String path) throws SVNException { SVNPathUtil.checkPathIsValid(path); String txnId = myTxnRoot.getTxnID(); FSParentPath parentPath = myTxnRoot.openPath(path, false, true); if (parentPath.getRevNode() != null) { SVNErrorManager.error(FSErrors.errorAlreadyExists(myTxnRoot, path, myFSFS), SVNLogType.FSFS); } if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, false, false); } makePathMutable(parentPath.getParent(), path); FSRevisionNode childNode = makeEntry(parentPath.getParent().getRevNode(), parentPath.getParent().getAbsPath(), parentPath.getEntryName(), false, txnId); myTxnRoot.putRevNodeToCache(parentPath.getAbsPath(), childNode); addChange(path, childNode.getId(), FSPathChangeKind.FS_PATH_CHANGE_ADD, false, false, SVNRepository.INVALID_REVISION, null, SVNNodeKind.FILE); }
public void changeNodeProperty(String path, String name, SVNPropertyValue propValue) throws SVNException { FSRepositoryUtil.validateProperty(name, propValue); FSTransactionRoot txnRoot = getTxnRoot(); FSParentPath parentPath = txnRoot.openPath(path, true, true); SVNNodeKind kind = parentPath.getRevNode().getType();
public void makeDir(String path) throws SVNException { SVNPathUtil.checkPathIsValid(path); FSTransactionRoot txnRoot = getTxnRoot(); String txnId = txnRoot.getTxnID(); FSParentPath parentPath = txnRoot.openPath(path, false, true); if (parentPath.getRevNode() != null) { SVNErrorManager.error(FSErrors.errorAlreadyExists(txnRoot, path, myFSFS), SVNLogType.FSFS); } if ((txnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, true, false); } makePathMutable(parentPath.getParent(), path); FSRevisionNode subDirNode = makeEntry(parentPath.getParent().getRevNode(), parentPath.getParent().getAbsPath(), parentPath.getEntryName(), true, txnId); txnRoot.putRevNodeToCache(parentPath.getAbsPath(), subDirNode); addChange(path, subDirNode.getId(), FSPathChangeKind.FS_PATH_CHANGE_ADD, false, false, false, SVNRepository.INVALID_REVISION, null, SVNNodeKind.DIR); }
public void changeNodeProperty(String path, String name, SVNPropertyValue propValue) throws SVNException { FSRepositoryUtil.validateProperty(name, propValue); FSParentPath parentPath = myTxnRoot.openPath(path, true, true); SVNNodeKind kind = parentPath.getRevNode().getType();
public void changeNodeProperty(String path, String name, SVNPropertyValue propValue) throws SVNException { FSRepositoryUtil.validateProperty(name, propValue); FSParentPath parentPath = myTxnRoot.openPath(path, true, true); SVNNodeKind kind = parentPath.getRevNode().getType();
public void makeFile(String path) throws SVNException { SVNPathUtil.checkPathIsValid(path); FSTransactionRoot txnRoot = getTxnRoot(); String txnId = txnRoot.getTxnID(); FSParentPath parentPath = txnRoot.openPath(path, false, true); if (parentPath.getRevNode() != null) { SVNErrorManager.error(FSErrors.errorAlreadyExists(txnRoot, path, myFSFS), SVNLogType.FSFS); } if ((txnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, false, false); } makePathMutable(parentPath.getParent(), path); FSRevisionNode childNode = makeEntry(parentPath.getParent().getRevNode(), parentPath.getParent().getAbsPath(), parentPath.getEntryName(), false, txnId); txnRoot.putRevNodeToCache(parentPath.getAbsPath(), childNode); addChange(path, childNode.getId(), FSPathChangeKind.FS_PATH_CHANGE_ADD, true, false, false, SVNRepository.INVALID_REVISION, null, SVNNodeKind.FILE); }
public void deleteNode(String path) throws SVNException { FSParentPath parentPath = myTxnRoot.openPath(path, true, true); SVNNodeKind kind = parentPath.getRevNode().getType(); if (parentPath.getParent() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ROOT_DIR, "The root directory cannot be deleted"); SVNErrorManager.error(err, SVNLogType.FSFS); } if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, true, false); } makePathMutable(parentPath.getParent(), path); myTxnRoot.deleteEntry(parentPath.getParent().getRevNode(), parentPath.getEntryName()); myTxnRoot.removeRevNodeFromCache(parentPath.getAbsPath()); if (myFSFS.supportsMergeInfo()) { long mergeInfoCount = parentPath.getRevNode().getMergeInfoCount(); if (mergeInfoCount > 0) { incrementMergeInfoUpTree(parentPath.getParent(), -mergeInfoCount); } } addChange(path, parentPath.getRevNode().getId(), FSPathChangeKind.FS_PATH_CHANGE_DELETE, false, false, SVNRepository.INVALID_REVISION, null, kind); }
public void deleteNode(String path) throws SVNException { FSParentPath parentPath = myTxnRoot.openPath(path, true, true); SVNNodeKind kind = parentPath.getRevNode().getType(); if (parentPath.getParent() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ROOT_DIR, "The root directory cannot be deleted"); SVNErrorManager.error(err, SVNLogType.FSFS); } if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, true, false); } makePathMutable(parentPath.getParent(), path); myTxnRoot.deleteEntry(parentPath.getParent().getRevNode(), parentPath.getEntryName()); myTxnRoot.removeRevNodeFromCache(parentPath.getAbsPath()); if (myFSFS.supportsMergeInfo()) { long mergeInfoCount = parentPath.getRevNode().getMergeInfoCount(); if (mergeInfoCount > 0) { incrementMergeInfoUpTree(parentPath.getParent(), -mergeInfoCount); } } addChange(path, parentPath.getRevNode().getId(), FSPathChangeKind.FS_PATH_CHANGE_DELETE, false, false, SVNRepository.INVALID_REVISION, null, kind); }
public void deleteNode(String path) throws SVNException { FSTransactionRoot txnRoot = getTxnRoot(); FSParentPath parentPath = txnRoot.openPath(path, true, true); SVNNodeKind kind = parentPath.getRevNode().getType(); if (parentPath.getParent() == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ROOT_DIR, "The root directory cannot be deleted"); SVNErrorManager.error(err, SVNLogType.FSFS); } if ((txnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, true, false); } makePathMutable(parentPath.getParent(), path); txnRoot.deleteEntry(parentPath.getParent().getRevNode(), parentPath.getEntryName()); txnRoot.removeRevNodeFromCache(parentPath.getAbsPath()); if (myFSFS.supportsMergeInfo()) { long mergeInfoCount = parentPath.getRevNode().getMergeInfoCount(); if (mergeInfoCount > 0) { incrementMergeInfoUpTree(parentPath.getParent(), -mergeInfoCount); } } addChange(path, parentPath.getRevNode().getId(), FSPathChangeKind.FS_PATH_CHANGE_DELETE, false, false, false, SVNRepository.INVALID_REVISION, null, kind); }
public void makeCopy(FSRevisionRoot fromRoot, String fromPath, String toPath, boolean preserveHistory) throws SVNException { String txnId = myTxnRoot.getTxnID(); FSRevisionNode fromNode = fromRoot.getRevisionNode(fromPath); FSParentPath toParentPath = myTxnRoot.openPath(toPath, false, true); if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { FSCommitter.allowLockedOperation(myFSFS, toPath, myAuthor, myLockTokens, true, false); } if (toParentPath.getRevNode() != null && toParentPath.getRevNode().getId().equals(fromNode.getId())) { return; } FSPathChangeKind changeKind; if (toParentPath.getRevNode() != null) { changeKind = FSPathChangeKind.FS_PATH_CHANGE_REPLACE; } else { changeKind = FSPathChangeKind.FS_PATH_CHANGE_ADD; } makePathMutable(toParentPath.getParent(), toPath); String fromCanonPath = fromPath; copy(toParentPath.getParent().getRevNode(), toParentPath.getNameEntry(), fromNode, preserveHistory, fromRoot.getRevision(), fromCanonPath, txnId); if (changeKind == FSPathChangeKind.FS_PATH_CHANGE_REPLACE) { myTxnRoot.removeRevNodeFromCache(toParentPath.getAbsPath()); } FSRevisionNode newNode = myTxnRoot.getRevisionNode(toPath); addChange(toPath, newNode.getId(), changeKind, false, false, fromRoot.getRevision(), fromCanonPath); }