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


Java IdentifiedUser.newCommitterIdent方法代码示例

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


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

示例1: getCommitterIdent

import com.google.gerrit.server.IdentifiedUser; //导入方法依赖的package包/类
private PersonIdent getCommitterIdent(Timestamp commitTimestamp) {
  IdentifiedUser user = currentUser.get().asIdentifiedUser();
  return user.newCommitterIdent(commitTimestamp, tz);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:ChangeEditModifier.java

示例2: createPersonIdent

import com.google.gerrit.server.IdentifiedUser; //导入方法依赖的package包/类
private PersonIdent createPersonIdent(IdentifiedUser user) {
  return user.newCommitterIdent(serverIdent.getWhen(), serverIdent.getTimeZone());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:4,代码来源:MetaDataUpdate.java

示例3: createPersonIdent

import com.google.gerrit.server.IdentifiedUser; //导入方法依赖的package包/类
private static PersonIdent createPersonIdent(PersonIdent ident, IdentifiedUser user) {
  return user.newCommitterIdent(ident.getWhen(), ident.getTimeZone());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:4,代码来源:GroupsUpdate.java

示例4: createPersonIdent

import com.google.gerrit.server.IdentifiedUser; //导入方法依赖的package包/类
private PersonIdent createPersonIdent(PersonIdent ident, IdentifiedUser user) {
  return user.newCommitterIdent(ident.getWhen(), ident.getTimeZone());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:4,代码来源:ExternalIdsUpdate.java

示例5: applyImpl

import com.google.gerrit.server.IdentifiedUser; //导入方法依赖的package包/类
@Override
protected Response<ChangeInfo> applyImpl(
    BatchUpdate.Factory updateFactory, ChangeResource rsrc, MergePatchSetInput in)
    throws OrmException, IOException, InvalidChangeOperationException, RestApiException,
        UpdateException, PermissionBackendException {
  rsrc.permissions().database(db).check(ChangePermission.ADD_PATCH_SET);

  MergeInput merge = in.merge;
  if (merge == null || Strings.isNullOrEmpty(merge.source)) {
    throw new BadRequestException("merge.source must be non-empty");
  }
  in.baseChange = Strings.nullToEmpty(in.baseChange).trim();

  PatchSet ps = psUtil.current(db.get(), rsrc.getNotes());
  ProjectState projectState = projectCache.checkedGet(rsrc.getProject());
  Change change = rsrc.getChange();
  Project.NameKey project = change.getProject();
  Branch.NameKey dest = change.getDest();
  try (Repository git = gitManager.openRepository(project);
      ObjectInserter oi = git.newObjectInserter();
      ObjectReader reader = oi.newReader();
      RevWalk rw = new RevWalk(reader)) {

    RevCommit sourceCommit = MergeUtil.resolveCommit(git, rw, merge.source);
    if (!commits.canRead(projectState, git, sourceCommit)) {
      throw new ResourceNotFoundException(
          "cannot find source commit: " + merge.source + " to merge.");
    }

    RevCommit currentPsCommit;
    List<String> groups = null;
    if (!in.inheritParent && !in.baseChange.isEmpty()) {
      PatchSet basePS = findBasePatchSet(in.baseChange);
      currentPsCommit = rw.parseCommit(ObjectId.fromString(basePS.getRevision().get()));
      groups = basePS.getGroups();
    } else {
      currentPsCommit = rw.parseCommit(ObjectId.fromString(ps.getRevision().get()));
    }

    Timestamp now = TimeUtil.nowTs();
    IdentifiedUser me = user.get().asIdentifiedUser();
    PersonIdent author = me.newCommitterIdent(now, serverTimeZone);
    RevCommit newCommit =
        createMergeCommit(
            in,
            projectState,
            dest,
            git,
            oi,
            rw,
            currentPsCommit,
            sourceCommit,
            author,
            ObjectId.fromString(change.getKey().get().substring(1)));

    PatchSet.Id nextPsId = ChangeUtil.nextPatchSetId(ps.getId());
    PatchSetInserter psInserter =
        patchSetInserterFactory.create(rsrc.getNotes(), nextPsId, newCommit);
    try (BatchUpdate bu = updateFactory.create(db.get(), project, me, now)) {
      bu.setRepository(git, rw, oi);
      psInserter
          .setMessage("Uploaded patch set " + nextPsId.get() + ".")
          .setNotify(NotifyHandling.NONE)
          .setCheckAddPatchSetPermission(false)
          .setNotify(NotifyHandling.NONE);
      if (groups != null) {
        psInserter.setGroups(groups);
      }
      bu.addOp(rsrc.getId(), psInserter);
      bu.execute();
    }

    ChangeJson json = jsonFactory.create(ListChangesOption.CURRENT_REVISION);
    return Response.ok(json.format(psInserter.getChange()));
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:77,代码来源:CreateMergePatchSet.java


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