return null; return createRevId(nodeId, copyId, rev, offset); } else if (revNodeId.charAt(0) == 't') { String txnId = revNodeId.substring(1); return createTxnId(nodeId, copyId, txnId);
public FSTransactionInfo(FSID rootID, FSID baseID) { myRootID = rootID; myBaseID = baseID; myTxnId = myRootID.getTxnID(); myBaseRevision = myBaseID.getRevision(); }
public FSID writeFinalRevision(FSID newId, final CountingStream protoFile, long revision, FSID id, String startNodeId, String startCopyId) throws SVNException, IOException { newId = null; if (!id.isTxn()) { return newId; FSEntry dirEntry = (FSEntry) entries.next(); newId = writeFinalRevision(newId, protoFile, revision, dirEntry.getId(), startNodeId, startCopyId); if (newId != null && newId.getRevision() == revision) { dirEntry.setId(newId); String nodeId = revNode.getId().getNodeID(); String copyId = revNode.getId().getCopyID(); newId = FSID.createRevId(myNodeId, myCopyId, revision, myOffset); revNode.setId(newId);
FSID revNodeID = FSID.fromString(revNodeIDStr); FSID id = FSID.fromString(rawID); if (id.getRevision() != rev) { continue; String nodeID = id.getNodeID(); String copyID = id.getCopyID(); if (nodeID.compareTo(maxNodeID[0]) > 0) { maxNodeID[0] = nodeID; continue; findMaxIDs(rev, revFile, id.getOffset(), maxNodeID, maxCopyID);
public FSID createSuccessor(FSID oldId, FSRevisionNode newRevNode, String copyId) throws SVNException { if (copyId == null) { copyId = oldId.getCopyID(); } FSID id = FSID.createTxnId(oldId.getNodeID(), copyId, myTxnID); newRevNode.setId(id); if (newRevNode.getCopyRootPath() == null) { newRevNode.setCopyRootPath(newRevNode.getCreatedPath()); newRevNode.setCopyRootRevision(newRevNode.getId().getRevision()); } getOwner().putTxnRevisionNode(newRevNode.getId(), newRevNode); return id; }
public void createNewTxnNodeRevisionFromRevision(String txnID, FSRevisionNode sourceNode) throws SVNException { if (sourceNode.getId().isTxn()) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Copying from transactions not allowed"); SVNErrorManager.error(err); } FSRevisionNode revNode = FSRevisionNode.dumpRevisionNode(sourceNode); revNode.setPredecessorId(sourceNode.getId()); revNode.setCount(revNode.getCount() + 1); revNode.setCopyFromPath(null); revNode.setCopyFromRevision(FSRepository.SVN_INVALID_REVNUM); revNode.setId(FSID.createTxnId(sourceNode.getId().getNodeID(), sourceNode.getId().getCopyID(), txnID)); putTxnRevisionNode(revNode.getId(), revNode); }
String childCopyID = childID.getCopyID(); String parentCopyID = parentID.getCopyID(); if (childID.isTxn()) { return new FSCopyInheritance(FSCopyInheritance.COPY_ID_INHERIT_SELF, null); FSRevisionNode copyrootNode = copyrootRoot.getRevisionNode(copyrootPath); FSID copyrootID = copyrootNode.getId(); if (copyrootID.compareTo(childID) == -1) { return copyInheritance;
public void makePathMutable(FSParentPath parentPath, String errorPath) throws SVNException { String txnId = myTxnRoot.getTxnID(); if (parentPath.getRevNode().getId().isTxn()) { return; case FSCopyInheritance.COPY_ID_INHERIT_PARENT: parentId = parentPath.getParent().getRevNode().getId(); copyId = parentId.getCopyID(); break; case FSCopyInheritance.COPY_ID_INHERIT_NEW: FSID copyRootId = copyRootNode.getId(); boolean isParentCopyRoot = false; if (!childId.getNodeID().equals(copyRootId.getNodeID())) { isParentCopyRoot = true; 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()
public long getNodeOriginRevision(String path) throws SVNException { path = SVNPathUtil.canonicalizeAbsolutePath(path); FSRevisionNode node = getRevisionNode(path); String nodeID = node.getId().getNodeID(); FSFS fsfs = getOwner(); if (nodeID.startsWith("_")) { FSID id = FSID.fromString(cachedOriginID); return id.getRevision();
FSID revnodeID = FSID.fromString(revNodeId); if (revnodeID == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Corrupt node-id in node-rev"); parseRepresentationHeader(propsRepr, revNode, revnodeID.getTxnID(), false); parseRepresentationHeader(textRepr, revNode, revnodeID.getTxnID(), true); FSID predRevNodeId = FSID.fromString(predId); if (predRevNodeId == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Corrupt predecessor node-id in node-rev"); if (copyroot == null) { revNode.setCopyRootPath(revNode.getCreatedPath()); revNode.setCopyRootRevision(revNode.getId().getRevision()); } else { parseCopyRoot(copyroot, revNode);
SVNNodeKind srcKind = srcEntry.getType(); int distance = srcEntry.getId().compareTo(tgtEntry.getId()); if (srcKind != tgtKind || distance == -1) { editor.deleteEntry(editFullPath, -1);
private FSID createNode(FSRevisionNode revNode, String copyId, String txnId) throws SVNException { String nodeId = getNewTxnNodeId(); FSID id = FSID.createTxnId(nodeId, copyId, txnId); revNode.setId(id); myFSFS.putTxnRevisionNode(id, revNode); return id; }
public static void mergeChanges(FSFS owner, FSTransactionRoot txnRoot, FSRevisionNode sourceNode, StringBuffer conflictPath) throws SVNException { FSRevisionNode txnRootNode = txnRoot.getRootRevisionNode(); FSRevisionNode ancestorNode = txnRoot.getTxnBaseRootNode(); if (txnRootNode.getId().equals(ancestorNode.getId())) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "FATAL error: no changes in transaction to commit"); SVNErrorManager.error(err, SVNLogType.FSFS); } else { merge(owner, "/", txnRootNode, sourceNode, ancestorNode, txnRoot, conflictPath); } }
public static FSID createRevId(String nodeId, String copyId, long revision, long offset) { return new FSID(nodeId, null, copyId, revision, offset); }
private void commit(String startNodeId, String startCopyId, long newRevision, OutputStream protoFileOS, FSID newRootId, FSTransactionRoot txnRoot, File revisionPrototypeFile, long offset) throws SVNException { try { protoFileOS = SVNFileUtil.openFileForWriting(revisionPrototypeFile, true); FSID rootId = FSID.createTxnId("0", "0", myTxn.getTxnId()); CountingOutputStream revWriter = new CountingOutputStream(protoFileOS, offset); newRootId = txnRoot.writeFinalRevision(newRootId, revWriter, newRevision, rootId, startNodeId, startCopyId); long changedPathOffset = txnRoot.writeFinalChangedPathInfo(revWriter); String offsetsLine = "\n" + newRootId.getOffset() + " " + changedPathOffset + "\n"; protoFileOS.write(offsetsLine.getBytes("UTF-8")); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } finally { SVNFileUtil.closeFile(protoFileOS); } SVNProperties txnProps = myFSFS.getTransactionProperties(myTxn.getTxnId()); if (txnProps != null && !txnProps.isEmpty()) { if (txnProps.getStringValue(SVNProperty.TXN_CHECK_OUT_OF_DATENESS) != null) { myFSFS.setTransactionProperty(myTxn.getTxnId(), SVNProperty.TXN_CHECK_OUT_OF_DATENESS, null); } if (txnProps.getStringValue(SVNProperty.TXN_CHECK_LOCKS) != null) { myFSFS.setTransactionProperty(myTxn.getTxnId(), SVNProperty.TXN_CHECK_LOCKS, null); } } }
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 long getCreatedRevision() { if (myFreshRootPredecessorId != null) { return myFreshRootPredecessorId.getRevision(); } return myId.getRevision(); }