当前位置: 首页>>代码示例>>Java>>正文


Java CommitBuilder.setParentId方法代码示例

本文整理汇总了Java中org.eclipse.jgit.lib.CommitBuilder.setParentId方法的典型用法代码示例。如果您正苦于以下问题:Java CommitBuilder.setParentId方法的具体用法?Java CommitBuilder.setParentId怎么用?Java CommitBuilder.setParentId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.lib.CommitBuilder的用法示例。


在下文中一共展示了CommitBuilder.setParentId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processCommit

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
/**
 * 
 * @param lastCommitId
 * @param treeId
 * @param repo
 * @param lastTreeId
 * @return
 * @throws IOException 
 */
public static ObjectId processCommit(ObjectId lastCommitId, ObjectId treeId, Repository repo, ObjectId lastTreeId) throws IOException {

    CommitBuilder commitBuilder = new CommitBuilder();

    ObjectId commitId = null;

    if (lastCommitId == null) {
        commitId = Commands.commit(commitBuilder, treeId, repo);
        System.out.println("Initial Commit: " + commitId);
    } else {
        if (lastTreeId.equals(treeId)) {
            // Do nothing, because there is no changes in the tree
            System.out.println("Did nothing, because there is no changes in the commited tree!\n");
        } else {
            commitBuilder.setParentId(lastCommitId);
            commitId = Commands.commit(commitBuilder, treeId, repo);
            System.out.println("Current Commit: " + commitId);
        }
    }

    return commitId;
}
 
开发者ID:alexmy21,项目名称:gmds,代码行数:32,代码来源:Commands.java

示例2: newCommit

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
private static RevCommit newCommit(
    ObjectInserter oi,
    RevWalk rw,
    PersonIdent authorIdent,
    RevCommit mergeTip,
    String commitMessage)
    throws IOException {
  CommitBuilder commit = new CommitBuilder();
  if (mergeTip == null) {
    commit.setTreeId(emptyTreeId(oi));
  } else {
    commit.setTreeId(mergeTip.getTree().getId());
    commit.setParentId(mergeTip);
  }
  commit.setAuthor(authorIdent);
  commit.setCommitter(authorIdent);
  commit.setMessage(commitMessage);
  return rw.parseCommit(insert(oi, commit));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:CreateChange.java

示例3: writeCommit

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
private RevCommit writeCommit(String body, PersonIdent author, boolean initWorkInProgress)
    throws Exception {
  Change change = newChange(initWorkInProgress);
  ChangeNotes notes = newNotes(change).load();
  try (ObjectInserter ins = testRepo.getRepository().newObjectInserter()) {
    CommitBuilder cb = new CommitBuilder();
    cb.setParentId(notes.getRevision());
    cb.setAuthor(author);
    cb.setCommitter(new PersonIdent(serverIdent, author.getWhen()));
    cb.setTreeId(testRepo.tree());
    cb.setMessage(body);
    ObjectId id = ins.insert(cb);
    ins.flush();
    RevCommit commit = walk.parseCommit(id);
    walk.parseBody(commit);
    return commit;
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:19,代码来源:ChangeNotesParserTest.java

示例4: rebase

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
@Nullable
  public static ObjectId rebase(Repository repository, ObjectId source, ObjectId target, PersonIdent committer) {
  	try (	RevWalk revWalk = new RevWalk(repository);
  			ObjectInserter inserter = repository.newObjectInserter();) {
  		RevCommit sourceCommit = revWalk.parseCommit(source);
  		RevCommit targetCommit = revWalk.parseCommit(target);
  		revWalk.setRevFilter(RevFilter.NO_MERGES);
  		List<RevCommit> commits = RevWalkUtils.find(revWalk, sourceCommit, targetCommit);
  		Collections.reverse(commits);
  		RevCommit headCommit = targetCommit;
  		for (RevCommit commit: commits) {
      		ResolveMerger merger = (ResolveMerger) MergeStrategy.RECURSIVE.newMerger(repository, true);
      		merger.setBase(commit.getParent(0));
      		if (merger.merge(headCommit, commit)) {
            if (!headCommit.getTree().getId().equals(merger.getResultTreeId())) {
                CommitBuilder newCommit = new CommitBuilder();
                newCommit.setAuthor(commit.getAuthorIdent());
                newCommit.setCommitter(committer);
                newCommit.setParentId(headCommit);
                newCommit.setMessage(commit.getFullMessage());
                newCommit.setTreeId(merger.getResultTreeId());
                headCommit = revWalk.parseCommit(inserter.insert(newCommit));
            }
      		} else {
      			return null;
      		}
  		}
  		inserter.flush();
  		return headCommit.copy();
  	} catch (IOException e) {
  		throw new RuntimeException(e);
}
  }
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:34,代码来源:GitUtils.java

示例5: merge

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
@Nullable
  public static ObjectId merge(Repository repository, ObjectId source, ObjectId target, 
  		boolean squash, PersonIdent committer, String commitMessage) {
  	try (	RevWalk revWalk = new RevWalk(repository);
  			ObjectInserter inserter = repository.newObjectInserter();) {
  		RevCommit sourceCommit = revWalk.parseCommit(source);
  		RevCommit targetCommit = revWalk.parseCommit(target);
  		Merger merger = MergeStrategy.RECURSIVE.newMerger(repository, true);
  		if (merger.merge(targetCommit, sourceCommit)) {
        CommitBuilder mergedCommit = new CommitBuilder();
        mergedCommit.setAuthor(sourceCommit.getAuthorIdent());
        mergedCommit.setCommitter(committer);
        if (squash)
        	mergedCommit.setParentId(targetCommit);
        else
        	mergedCommit.setParentIds(targetCommit, sourceCommit);
        mergedCommit.setMessage(commitMessage);
        mergedCommit.setTreeId(merger.getResultTreeId());
        ObjectId mergedCommitId = inserter.insert(mergedCommit);
        inserter.flush();
        return mergedCommitId;
  		} else {
  			return null;
  		}
  	} catch (IOException e) {
  		throw new RuntimeException(e);
}
  }
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:29,代码来源:GitUtils.java

示例6: updateProjectRef

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
public static void updateProjectRef(ObjectId treeId, ObjectInserter objectInserter, Repository repository, CurrentUser currentUser)
        throws IOException, NoFilepatternException, GitAPIException {
    // Create a branch
    Ref gerritCiRef = repository.getRef("refs/meta/gerrit-ci");
    CommitBuilder commitBuilder = new CommitBuilder();
    commitBuilder.setTreeId(treeId);
    logger.info("treeId: " + treeId);

    if (gerritCiRef != null) {
        ObjectId prevCommit = gerritCiRef.getObjectId();
        logger.info("prevCommit: " + prevCommit);
        commitBuilder.setParentId(prevCommit);
    }
    // build commit
    logger.info("Adding git tree : " + treeId);
    commitBuilder.setMessage("Modify project build rules.");
    final IdentifiedUser iUser = (IdentifiedUser) currentUser;
    PersonIdent user = new PersonIdent(currentUser.getUserName(), iUser.getEmailAddresses().iterator().next());
    commitBuilder.setAuthor(user);
    commitBuilder.setCommitter(user);
    ObjectId commitId = objectInserter.insert(commitBuilder);
    objectInserter.flush();
    logger.info(" Making new commit: " + commitId);
    RefUpdate newRef = repository.updateRef("refs/meta/gerrit-ci");
    newRef.setNewObjectId(commitId);
    newRef.update();
    repository.close();
}
 
开发者ID:palantir,项目名称:gerrit-ci,代码行数:29,代码来源:JobsServlet.java

示例7: createCherryPickFromCommit

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
public CodeReviewCommit createCherryPickFromCommit(
    ObjectInserter inserter,
    Config repoConfig,
    RevCommit mergeTip,
    RevCommit originalCommit,
    PersonIdent cherryPickCommitterIdent,
    String commitMsg,
    CodeReviewRevWalk rw,
    int parentIndex,
    boolean ignoreIdenticalTree)
    throws MissingObjectException, IncorrectObjectTypeException, IOException,
        MergeIdenticalTreeException, MergeConflictException {

  final ThreeWayMerger m = newThreeWayMerger(inserter, repoConfig);

  m.setBase(originalCommit.getParent(parentIndex));
  if (m.merge(mergeTip, originalCommit)) {
    ObjectId tree = m.getResultTreeId();
    if (tree.equals(mergeTip.getTree()) && !ignoreIdenticalTree) {
      throw new MergeIdenticalTreeException("identical tree");
    }

    CommitBuilder mergeCommit = new CommitBuilder();
    mergeCommit.setTreeId(tree);
    mergeCommit.setParentId(mergeTip);
    mergeCommit.setAuthor(originalCommit.getAuthorIdent());
    mergeCommit.setCommitter(cherryPickCommitterIdent);
    mergeCommit.setMessage(commitMsg);
    matchAuthorToCommitterDate(project, mergeCommit);
    return rw.parseCommit(inserter.insert(mergeCommit));
  }
  throw new MergeConflictException("merge conflict");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:34,代码来源:MergeUtil.java

示例8: apply

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
/**
 * Apply this update to the given inserter.
 *
 * @param rw walk for reading back any objects needed for the update.
 * @param ins inserter to write to; callers should not flush.
 * @param curr the current tip of the branch prior to this update.
 * @return commit ID produced by inserting this update's commit, or null if this update is a no-op
 *     and should be skipped. The zero ID is a valid return value, and indicates the ref should be
 *     deleted.
 * @throws OrmException if a Gerrit-level error occurred.
 * @throws IOException if a lower-level error occurred.
 */
final ObjectId apply(RevWalk rw, ObjectInserter ins, ObjectId curr)
    throws OrmException, IOException {
  if (isEmpty()) {
    return null;
  }

  // Allow this method to proceed even if migration.failChangeWrites() = true.
  // This may be used by an auto-rebuilding step that the caller does not plan
  // to actually store.

  checkArgument(rw.getObjectReader().getCreatedFromInserter() == ins);
  checkNotReadOnly();
  ObjectId z = ObjectId.zeroId();
  CommitBuilder cb = applyImpl(rw, ins, curr);
  if (cb == null) {
    result = z;
    return z; // Impl intends to delete the ref.
  } else if (cb == NO_OP_UPDATE) {
    return null; // Impl is a no-op.
  }
  cb.setAuthor(authorIdent);
  cb.setCommitter(new PersonIdent(serverIdent, when));
  if (!curr.equals(z)) {
    cb.setParentId(curr);
  } else {
    cb.setParentIds(); // Ref is currently nonexistent, commit has no parents.
  }
  if (cb.getTreeId() == null) {
    if (curr.equals(z)) {
      cb.setTreeId(emptyTree(ins)); // No parent, assume empty tree.
    } else {
      RevCommit p = rw.parseCommit(curr);
      cb.setTreeId(p.getTree()); // Copy tree from parent.
    }
  }
  result = ins.insert(cb);
  return result;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:51,代码来源:AbstractChangeUpdate.java

示例9: rebaseCommit

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
/**
 * Rebase a commit.
 *
 * @param ctx repo context.
 * @param original the commit to rebase.
 * @param base base to rebase against.
 * @return the rebased commit.
 * @throws MergeConflictException the rebase failed due to a merge conflict.
 * @throws IOException the merge failed for another reason.
 */
private RevCommit rebaseCommit(
    RepoContext ctx, RevCommit original, ObjectId base, String commitMessage)
    throws ResourceConflictException, IOException {
  RevCommit parentCommit = original.getParent(0);

  if (base.equals(parentCommit)) {
    throw new ResourceConflictException("Change is already up to date.");
  }

  ThreeWayMerger merger =
      newMergeUtil().newThreeWayMerger(ctx.getInserter(), ctx.getRepoView().getConfig());
  merger.setBase(parentCommit);
  merger.merge(original, base);

  if (merger.getResultTreeId() == null) {
    throw new MergeConflictException(
        "The change could not be rebased due to a conflict during merge.");
  }

  CommitBuilder cb = new CommitBuilder();
  cb.setTreeId(merger.getResultTreeId());
  cb.setParentId(base);
  cb.setAuthor(original.getAuthorIdent());
  cb.setMessage(commitMessage);
  if (committerIdent != null) {
    cb.setCommitter(committerIdent);
  } else {
    cb.setCommitter(ctx.getIdentifiedUser().newCommitterIdent(ctx.getWhen(), ctx.getTimeZone()));
  }
  if (matchAuthorToCommitterDate) {
    cb.setAuthor(
        new PersonIdent(
            cb.getAuthor(), cb.getCommitter().getWhen(), cb.getCommitter().getTimeZone()));
  }
  ObjectId objectId = ctx.getInserter().insert(cb);
  ctx.getInserter().flush();
  return ctx.getRevWalk().parseCommit(objectId);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:49,代码来源:RebaseChangeOp.java

示例10: newCommit

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
private ObjectId newCommit(RevWalk rw, ObjectInserter ins, ObjectId parent, String msg)
    throws IOException {
  PersonIdent ident = serverIdent.get();
  CommitBuilder cb = new CommitBuilder();
  cb.setParentId(parent);
  cb.setTreeId(rw.parseCommit(parent).getTree());
  cb.setMessage(msg);
  cb.setAuthor(ident);
  cb.setCommitter(ident);
  return ins.insert(Constants.OBJ_COMMIT, cb.build());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:12,代码来源:NoteDbOnlyIT.java

示例11: execute

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
public void execute() {
    final Repository repo = this.git.getRepository();

    final RevCommit latestCommit = git.getLastCommit(branch);
    final RevCommit startCommit = checkIfCommitIsPresentAtBranch(this.git,
                                                                 this.branch,
                                                                 this.startCommitString);

    RevCommit parent = startCommit;
    if (startCommit.getParentCount() > 0) {
        parent = startCommit.getParent(0);
    }

    final CommitBuilder commitBuilder = new CommitBuilder();
    commitBuilder.setParentId(parent);
    commitBuilder.setTreeId(latestCommit.getTree().getId());
    commitBuilder.setMessage(squashedCommitMessage);
    commitBuilder.setAuthor(startCommit.getAuthorIdent());
    commitBuilder.setCommitter(startCommit.getAuthorIdent());

    try (final ObjectInserter odi = repo.newObjectInserter()) {
        final RevCommit squashedCommit = git.resolveRevCommit(odi.insert(commitBuilder));
        git.refUpdate(branch,
                      squashedCommit);
    } catch (ConcurrentRefUpdateException | IOException e) {
        throw new GitException("Error on executing squash.",
                               e);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:30,代码来源:Squash.java

示例12: save

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
/**
 * Save pending keys to the store.
 *
 * <p>One commit is created and the ref updated. The pending list is cleared if and only if the
 * ref update succeeds, which allows for easy retries in case of lock failure.
 *
 * @param cb commit builder with at least author and identity populated; tree and parent are
 *     ignored.
 * @return result of the ref update.
 */
public RefUpdate.Result save(CommitBuilder cb) throws PGPException, IOException {
  if (toAdd.isEmpty() && toRemove.isEmpty()) {
    return RefUpdate.Result.NO_CHANGE;
  }
  if (reader == null) {
    load();
  }
  if (notes == null) {
    notes = NoteMap.newEmptyMap();
  }
  ObjectId newTip;
  try (ObjectInserter ins = repo.newObjectInserter()) {
    for (PGPPublicKeyRing keyRing : toAdd.values()) {
      saveToNotes(ins, keyRing);
    }
    for (Fingerprint fp : toRemove) {
      deleteFromNotes(ins, fp);
    }
    cb.setTreeId(notes.writeTree(ins));
    if (cb.getTreeId().equals(tip != null ? tip.getTree() : EMPTY_TREE)) {
      return RefUpdate.Result.NO_CHANGE;
    }

    if (tip != null) {
      cb.setParentId(tip);
    }
    if (cb.getMessage() == null) {
      int n = toAdd.size() + toRemove.size();
      cb.setMessage(String.format("Update %d public key%s", n, n != 1 ? "s" : ""));
    }
    newTip = ins.insert(cb);
    ins.flush();
  }

  RefUpdate ru = repo.updateRef(PublicKeyStore.REFS_GPG_KEYS);
  ru.setExpectedOldObjectId(tip);
  ru.setNewObjectId(newTip);
  ru.setRefLogIdent(cb.getCommitter());
  ru.setRefLogMessage("Store public keys", true);
  RefUpdate.Result result = ru.update();
  reset();
  switch (result) {
    case FAST_FORWARD:
    case NEW:
    case NO_CHANGE:
      toAdd.clear();
      toRemove.clear();
      break;
    case FORCED:
    case IO_FAILURE:
    case LOCK_FAILURE:
    case NOT_ATTEMPTED:
    case REJECTED:
    case REJECTED_CURRENT_BRANCH:
    case RENAMED:
    case REJECTED_MISSING_OBJECT:
    case REJECTED_OTHER_REASON:
    default:
      break;
  }
  return result;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:73,代码来源:PublicKeyStore.java

示例13: composeGitlinksCommit

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
/** Create a separate gitlink commit */
public CodeReviewCommit composeGitlinksCommit(Branch.NameKey subscriber)
    throws IOException, SubmoduleException {
  OpenRepo or;
  try {
    or = orm.getRepo(subscriber.getParentKey());
  } catch (NoSuchProjectException | IOException e) {
    throw new SubmoduleException("Cannot access superproject", e);
  }

  CodeReviewCommit currentCommit;
  if (branchTips.containsKey(subscriber)) {
    currentCommit = branchTips.get(subscriber);
  } else {
    Ref r = or.repo.exactRef(subscriber.get());
    if (r == null) {
      throw new SubmoduleException(
          "The branch was probably deleted from the subscriber repository");
    }
    currentCommit = or.rw.parseCommit(r.getObjectId());
    addBranchTip(subscriber, currentCommit);
  }

  StringBuilder msgbuf = new StringBuilder("");
  PersonIdent author = null;
  DirCache dc = readTree(or.rw, currentCommit);
  DirCacheEditor ed = dc.editor();
  for (SubmoduleSubscription s : targets.get(subscriber)) {
    RevCommit newCommit = updateSubmodule(dc, ed, msgbuf, s);
    if (newCommit != null) {
      if (author == null) {
        author = newCommit.getAuthorIdent();
      } else if (!author.equals(newCommit.getAuthorIdent())) {
        author = myIdent;
      }
    }
  }
  ed.finish();
  ObjectId newTreeId = dc.writeTree(or.ins);

  // Gitlinks are already in the branch, return null
  if (newTreeId.equals(currentCommit.getTree())) {
    return null;
  }
  CommitBuilder commit = new CommitBuilder();
  commit.setTreeId(newTreeId);
  commit.setParentId(currentCommit);
  StringBuilder commitMsg = new StringBuilder("Update git submodules\n\n");
  if (verboseSuperProject != VerboseSuperprojectUpdate.FALSE) {
    commitMsg.append(msgbuf);
  }
  commit.setMessage(commitMsg.toString());
  commit.setAuthor(author);
  commit.setCommitter(myIdent);
  ObjectId id = or.ins.insert(commit);
  return or.rw.parseCommit(id);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:58,代码来源:SubmoduleOp.java

示例14: commit

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
/** Commits updates to the external IDs. */
public static ObjectId commit(
    Project.NameKey project,
    Repository repo,
    RevWalk rw,
    ObjectInserter ins,
    ObjectId rev,
    NoteMap noteMap,
    String commitMessage,
    PersonIdent committerIdent,
    PersonIdent authorIdent,
    @Nullable IdentifiedUser user,
    GitReferenceUpdated gitRefUpdated)
    throws IOException {
  CommitBuilder cb = new CommitBuilder();
  cb.setMessage(commitMessage);
  cb.setTreeId(noteMap.writeTree(ins));
  cb.setAuthor(authorIdent);
  cb.setCommitter(committerIdent);
  if (!rev.equals(ObjectId.zeroId())) {
    cb.setParentId(rev);
  } else {
    cb.setParentIds(); // Ref is currently nonexistent, commit has no parents.
  }
  if (cb.getTreeId() == null) {
    if (rev.equals(ObjectId.zeroId())) {
      cb.setTreeId(emptyTree(ins)); // No parent, assume empty tree.
    } else {
      RevCommit p = rw.parseCommit(rev);
      cb.setTreeId(p.getTree()); // Copy tree from parent.
    }
  }
  ObjectId commitId = ins.insert(cb);
  ins.flush();

  RefUpdate u = repo.updateRef(RefNames.REFS_EXTERNAL_IDS);
  u.setRefLogIdent(committerIdent);
  u.setRefLogMessage("Update external IDs", false);
  u.setExpectedOldObjectId(rev);
  u.setNewObjectId(commitId);
  RefUpdate.Result res = u.update();
  switch (res) {
    case NEW:
    case FAST_FORWARD:
    case NO_CHANGE:
    case RENAMED:
    case FORCED:
      break;
    case LOCK_FAILURE:
      throw new LockFailureException("Updating external IDs failed with " + res, u);
    case IO_FAILURE:
    case NOT_ATTEMPTED:
    case REJECTED:
    case REJECTED_CURRENT_BRANCH:
    case REJECTED_MISSING_OBJECT:
    case REJECTED_OTHER_REASON:
    default:
      throw new IOException("Updating external IDs failed with " + res);
  }
  gitRefUpdated.fire(project, u, user != null ? user.getAccount() : null);
  return rw.parseCommit(commitId);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:63,代码来源:ExternalIdsUpdate.java

示例15: rewriteUserBranch

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
private void rewriteUserBranch(
    Repository repo,
    RevWalk rw,
    ObjectInserter oi,
    ObjectId emptyTree,
    Ref ref,
    Timestamp registeredOn)
    throws IOException {
  ObjectId current = createInitialEmptyCommit(oi, emptyTree, registeredOn);

  rw.reset();
  rw.sort(RevSort.TOPO);
  rw.sort(RevSort.REVERSE, true);
  rw.markStart(rw.parseCommit(ref.getObjectId()));

  RevCommit c;
  while ((c = rw.next()) != null) {
    if (isInitialEmptyCommit(emptyTree, c)) {
      return;
    }

    CommitBuilder cb = new CommitBuilder();
    cb.setParentId(current);
    cb.setTreeId(c.getTree());
    cb.setAuthor(c.getAuthorIdent());
    cb.setCommitter(c.getCommitterIdent());
    cb.setMessage(c.getFullMessage());
    cb.setEncoding(c.getEncoding());
    current = oi.insert(cb);
  }

  oi.flush();

  RefUpdate ru = repo.updateRef(ref.getName());
  ru.setExpectedOldObjectId(ref.getObjectId());
  ru.setNewObjectId(current);
  ru.setForceUpdate(true);
  ru.setRefLogIdent(serverIdent);
  ru.setRefLogMessage(getClass().getSimpleName(), true);
  Result result = ru.update();
  if (result != Result.FORCED) {
    throw new IOException(
        String.format("Failed to update ref %s: %s", ref.getName(), result.name()));
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:46,代码来源:Schema_146.java


注:本文中的org.eclipse.jgit.lib.CommitBuilder.setParentId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。