示例#1
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;
  }