Esempio n. 1
0
  private void copy(
      FSRevisionNode toNode,
      String entryName,
      FSRevisionNode fromNode,
      boolean preserveHistory,
      long fromRevision,
      String fromPath,
      String txnId)
      throws SVNException {
    FSID id = null;
    FSTransactionRoot txnRoot = getTxnRoot();
    if (preserveHistory) {
      FSID srcId = fromNode.getId();
      FSRevisionNode toRevNode = FSRevisionNode.dumpRevisionNode(fromNode);
      String copyId = reserveCopyId(txnId);

      toRevNode.setPredecessorId(srcId);
      if (toRevNode.getCount() != -1) {
        toRevNode.setCount(toRevNode.getCount() + 1);
      }
      String createdPath =
          SVNPathUtil.getAbsolutePath(SVNPathUtil.append(toNode.getCreatedPath(), entryName));
      toRevNode.setCreatedPath(createdPath);
      toRevNode.setCopyFromPath(fromPath);
      toRevNode.setCopyFromRevision(fromRevision);

      toRevNode.setCopyRootPath(null);
      id = txnRoot.createSuccessor(srcId, toRevNode, copyId);
    } else {
      id = fromNode.getId();
    }

    txnRoot.setEntry(toNode, entryName, id, fromNode.getType());
  }
Esempio n. 2
0
  public FSRevisionNode makeEntry(
      FSRevisionNode parent, String parentPath, String entryName, boolean isDir, String txnId)
      throws SVNException {
    if (!SVNPathUtil.isSinglePathComponent(entryName)) {
      SVNErrorMessage err =
          SVNErrorMessage.create(
              SVNErrorCode.FS_NOT_SINGLE_PATH_COMPONENT,
              "Attempted to create a node with an illegal name ''{0}''",
              entryName);
      SVNErrorManager.error(err, SVNLogType.FSFS);
    }

    if (parent.getType() != SVNNodeKind.DIR) {
      SVNErrorMessage err =
          SVNErrorMessage.create(
              SVNErrorCode.FS_NOT_DIRECTORY, "Attempted to create entry in non-directory parent");
      SVNErrorManager.error(err, SVNLogType.FSFS);
    }

    if (!parent.getId().isTxn()) {
      SVNErrorMessage err =
          SVNErrorMessage.create(
              SVNErrorCode.FS_NOT_MUTABLE, "Attempted to clone child of non-mutable node");
      SVNErrorManager.error(err, SVNLogType.FSFS);
    }

    FSRevisionNode newRevNode = new FSRevisionNode();
    newRevNode.setType(isDir ? SVNNodeKind.DIR : SVNNodeKind.FILE);
    String createdPath = SVNPathUtil.getAbsolutePath(SVNPathUtil.append(parentPath, entryName));
    newRevNode.setCreatedPath(createdPath);
    newRevNode.setCopyRootPath(parent.getCopyRootPath());
    newRevNode.setCopyRootRevision(parent.getCopyRootRevision());
    newRevNode.setCopyFromRevision(SVNRepository.INVALID_REVISION);
    newRevNode.setCopyFromPath(null);
    FSID newNodeId = createNode(newRevNode, parent.getId().getCopyID(), txnId);

    FSRevisionNode childNode = myFSFS.getRevisionNode(newNodeId);

    FSTransactionRoot txnRoot = getTxnRoot();
    txnRoot.setEntry(parent, entryName, childNode.getId(), newRevNode.getType());
    return childNode;
  }