public static FSTransactionInfo beginTransaction(long baseRevision, int flags, FSFS owner) throws SVNException { FSTransactionInfo txn = createTxn(baseRevision, owner); String commitTime = SVNDate.formatDate(new Date(System.currentTimeMillis())); owner.setTransactionProperty(txn.getTxnId(), SVNRevisionProperty.DATE, SVNPropertyValue.create(commitTime)); if ((flags & SVN_FS_TXN_CHECK_OUT_OF_DATENESS) != 0) { owner.setTransactionProperty(txn.getTxnId(), SVNProperty.TXN_CHECK_OUT_OF_DATENESS, SVNPropertyValue.create(Boolean.TRUE.toString())); } if ((flags & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) { owner.setTransactionProperty(txn.getTxnId(), SVNProperty.TXN_CHECK_LOCKS, SVNPropertyValue.create(Boolean.TRUE.toString())); } return txn; }
private static FSTransactionInfo createTxn(long baseRevision, FSFS owner) throws SVNException { String txnID = createTxnDir(baseRevision, owner); FSTransactionInfo txn = new FSTransactionInfo(baseRevision, txnID); FSRevisionRoot root = owner.createRevisionRoot(baseRevision); FSRevisionNode rootNode = root.getRootRevisionNode(); owner.createNewTxnNodeRevisionFromRevision(txnID, rootNode); SVNFileUtil.createEmptyFile(new File(owner.getTransactionDir(txn.getTxnId()), FSFS.TXN_PATH_REV)); SVNFileUtil.createEmptyFile(new File(owner.getTransactionDir(txn.getTxnId()), "changes")); owner.writeNextIDs(txnID, "0", "0"); return txn; }
public FSRevisionNode getTxnBaseRootNode() throws SVNException { FSTransactionInfo txn = getTxn(); FSRevisionNode baseRootNode = getOwner().getRevisionNode(txn.getBaseID()); return baseRootNode; }
public FSTransactionRoot createTransactionRoot(FSTransactionInfo txn) throws SVNException { SVNProperties txnProps = getTransactionProperties(txn.getTxnId()); int flags = 0; if (txnProps.getStringValue(SVNProperty.TXN_CHECK_OUT_OF_DATENESS) != null) { flags |= FSTransactionRoot.SVN_FS_TXN_CHECK_OUT_OF_DATENESS; } if (txnProps.getStringValue(SVNProperty.TXN_CHECK_LOCKS) != null) { flags |= FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS; } return new FSTransactionRoot(this, txn.getTxnId(), txn.getBaseRevision(), flags); }
public FSTransactionInfo openTxn(String txnName) throws SVNException { SVNFileType kind = SVNFileType.getType(getTransactionDir(txnName)); if (kind != SVNFileType.DIRECTORY) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NO_SUCH_TRANSACTION, "No such transaction"); SVNErrorManager.error(err, SVNLogType.FSFS); } FSTransactionRoot txnRoot = new FSTransactionRoot(this, txnName, -1, 0); FSTransactionInfo localTxn = txnRoot.getTxn(); return new FSTransactionInfo(localTxn.getBaseRevision(), txnName); }
FSTransactionInfo txn = myTxnRoot.getTxn(); if (txn.getRootID().equals(txn.getBaseID())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "FATAL error: txn ''{0}'' root id ''{1}'' matches base id ''{2}''", new Object[] { txnId, txn.getRootID(), txn.getBaseID() }); SVNErrorManager.error(err, SVNLogType.FSFS); clone = myFSFS.getRevisionNode(txn.getRootID());
public long commitTxn(boolean runPreCommitHook, boolean runPostCommitHook, SVNErrorMessage[] postCommitHookError, StringBuffer conflictPath) throws SVNException { if (myFSFS.isHooksEnabled() && runPreCommitHook) { FSHooks.runPreCommitHook(myFSFS.getRepositoryRoot(), myTxn.getTxnId()); final SVNProperties txnProperties = myFSFS.getTransactionProperties(myTxn.getTxnId()); for (String propertyName : new HashSet<String>(txnProperties.nameSet())) { if (propertyName.startsWith(SVNRevisionProperty.SVN_TXN_PREFIX)) { myFSFS.setTransactionProperty(myTxn.getTxnId(), propertyName, null); myTxn.setBaseRevision(youngishRev);
} else if (root instanceof FSTransactionRoot) { FSTransactionRoot txnRoot = (FSTransactionRoot) root; revision = txnRoot.getTxn().getBaseRevision();
public FSRevisionNode getRootRevisionNode() throws SVNException { if (myRootRevisionNode == null) { FSTransactionInfo txn = getTxn(); myRootRevisionNode = getOwner().getRevisionNode(txn.getRootID()); } return myRootRevisionNode; }
public FSTransactionInfo getTxn() throws SVNException { FSID rootID = FSID.createTxnId("0", "0", myTxnID); FSRevisionNode revNode = getOwner().getRevisionNode(rootID); FSTransactionInfo txn = new FSTransactionInfo(revNode.getId(), revNode.getPredecessorId()); return txn; }
public long commitTxn() throws SVNException { long newRevision = FSRepository.SVN_INVALID_REVNUM; while (true) { long youngishRev = myFSFS.getYoungestRevision(); FSRevisionRoot youngishRoot = myFSFS.createRevisionRoot(youngishRev); FSRevisionNode youngishRootNode = youngishRoot.getRevisionNode("/"); mergeChanges(null, youngishRootNode); myTxn.setBaseRevision(youngishRev); FSWriteLock writeLock = FSWriteLock.getWriteLock(myFSFS); synchronized (writeLock) { try { writeLock.lock(); newRevision = commit(); } catch (SVNException svne) { if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.FS_TXN_OUT_OF_DATE) { long youngestRev = myFSFS.getYoungestRevision(); if (youngishRev == youngestRev) { throw svne; } continue; } throw svne; } finally { writeLock.unlock(); FSWriteLock.realease(writeLock); } } return newRevision; } }
public FSTransactionRoot createTransactionRoot(FSTransactionInfo txn) throws SVNException { SVNProperties txnProps = getTransactionProperties(txn.getTxnId()); int flags = 0; if (txnProps.getStringValue(SVNProperty.TXN_CHECK_OUT_OF_DATENESS) != null) { flags |= FSTransactionRoot.SVN_FS_TXN_CHECK_OUT_OF_DATENESS; } if (txnProps.getStringValue(SVNProperty.TXN_CHECK_LOCKS) != null) { flags |= FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS; } return new FSTransactionRoot(this, txn.getTxnId(), txn.getBaseRevision(), flags); }
FSTransactionInfo txn = myTxnRoot.getTxn(); if (txn.getRootID().equals(txn.getBaseID())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "FATAL error: txn ''{0}'' root id ''{1}'' matches base id ''{2}''", new Object[] { txnId, txn.getRootID(), txn.getBaseID() }); SVNErrorManager.error(err); clone = myFSFS.getRevisionNode(txn.getRootID());
public long commitTxn(boolean runPreCommitHook, boolean runPostCommitHook, SVNErrorMessage[] postCommitHookError, StringBuffer conflictPath) throws SVNException { if (runPreCommitHook) { FSHooks.runPreCommitHook(myFSFS.getRepositoryRoot(), myTxn.getTxnId()); myTxn.setBaseRevision(youngishRev);
public FSTransactionInfo openTxn(String txnName) throws SVNException { SVNFileType kind = SVNFileType.getType(getTransactionDir(txnName)); if (kind != SVNFileType.DIRECTORY) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NO_SUCH_TRANSACTION, "No such transaction"); SVNErrorManager.error(err, SVNLogType.FSFS); } FSTransactionRoot txnRoot = new FSTransactionRoot(this, txnName, -1, 0); FSTransactionInfo localTxn = txnRoot.getTxn(); return new FSTransactionInfo(localTxn.getBaseRevision(), txnName); }
} else if (root instanceof FSTransactionRoot) { FSTransactionRoot txnRoot = (FSTransactionRoot) root; revision = txnRoot.getTxn().getBaseRevision();
public FSRevisionNode getRootRevisionNode() throws SVNException { if (myRootRevisionNode == null) { FSTransactionInfo txn = getTxn(); myRootRevisionNode = getOwner().getRevisionNode(txn.getRootID()); } return myRootRevisionNode; }
public FSTransactionInfo getTxn() throws SVNException { FSID rootID = FSID.createTxnId("0", "0", myTxnID); FSRevisionNode revNode = getOwner().getRevisionNode(rootID); FSTransactionInfo txn = new FSTransactionInfo(revNode.getId(), revNode.getPredecessorId()); return txn; }
private FSTransactionInfo beginTransactionForCommit(long baseRevision) throws SVNException { FSHooks.runStartCommitHook(myFSFS.getRepositoryRoot(), myAuthor); FSTransactionInfo txn = FSTransactionRoot.beginTransaction(baseRevision, FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS, myFSFS); if (myAuthor != null && !"".equals(myAuthor)) { myFSFS.setTransactionProperty(txn.getTxnId(), SVNRevisionProperty.AUTHOR, myAuthor); } if (myLogMessage != null && !"".equals(myLogMessage)) { myFSFS.setTransactionProperty(txn.getTxnId(), SVNRevisionProperty.LOG, myLogMessage); } return txn; }
public FSTransactionRoot createTransactionRoot(FSTransactionInfo txn) throws SVNException { SVNProperties txnProps = getTransactionProperties(txn.getTxnId()); int flags = 0; if (txnProps.getStringValue(SVNProperty.TXN_CHECK_OUT_OF_DATENESS) != null) { flags |= FSTransactionRoot.SVN_FS_TXN_CHECK_OUT_OF_DATENESS; } if (txnProps.getStringValue(SVNProperty.TXN_CHECK_LOCKS) != null) { flags |= FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS; } return new FSTransactionRoot(this, txn.getTxnId(), txn.getBaseRevision(), flags); }