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


Java CommitBuilder.getMessage方法代码示例

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


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

示例1: onSave

import org.eclipse.jgit.lib.CommitBuilder; //导入方法依赖的package包/类
@Override
protected boolean onSave(CommitBuilder commit) throws IOException, ConfigInvalidException {
  if (commit.getMessage() == null || "".equals(commit.getMessage())) {
    commit.setMessage("Updated configuration\n");
  }
  saveConfig(fileName, cfg);
  return true;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:ProjectLevelConfig.java

示例2: 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


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