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


Java ReceiveCommand.getType方法代码示例

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


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

示例1: processCommands

import org.eclipse.jgit.transport.ReceiveCommand; //导入方法依赖的package包/类
void processCommands(Collection<ReceiveCommand> commands, MultiProgressMonitor progress) {
  newProgress = progress.beginSubTask("new", UNKNOWN);
  replaceProgress = progress.beginSubTask("updated", UNKNOWN);
  closeProgress = progress.beginSubTask("closed", UNKNOWN);
  commandProgress = progress.beginSubTask("refs", UNKNOWN);

  try {
    parseCommands(commands);
  } catch (PermissionBackendException | NoSuchProjectException | IOException err) {
    for (ReceiveCommand cmd : actualCommands) {
      if (cmd.getResult() == NOT_ATTEMPTED) {
        cmd.setResult(REJECTED_OTHER_REASON, "internal server error");
      }
    }
    logError(String.format("Failed to process refs in %s", project.getName()), err);
  }
  if (magicBranch != null && magicBranch.cmd.getResult() == NOT_ATTEMPTED) {
    selectNewAndReplacedChangesFromMagicBranch();
  }
  preparePatchSetsForReplace();
  insertChangesAndPatchSets();
  newProgress.end();
  replaceProgress.end();

  if (!errors.isEmpty()) {
    logDebug("Handling error conditions: {}", errors.keySet());
    for (ReceiveError error : errors.keySet()) {
      rp.sendMessage(buildError(error, errors.get(error)));
    }
    rp.sendMessage(String.format("User: %s", displayName(user)));
    rp.sendMessage(COMMAND_REJECTION_MESSAGE_FOOTER);
  }

  Set<Branch.NameKey> branches = new HashSet<>();
  for (ReceiveCommand c : actualCommands) {
    // Most post-update steps should happen in UpdateOneRefOp#postUpdate. The only steps that
    // should happen in this loop are things that can't happen within one BatchUpdate because they
    // involve kicking off an additional BatchUpdate.
    if (c.getResult() != OK) {
      continue;
    }
    if (isHead(c) || isConfig(c)) {
      switch (c.getType()) {
        case CREATE:
        case UPDATE:
        case UPDATE_NONFASTFORWARD:
          autoCloseChanges(c);
          branches.add(new Branch.NameKey(project.getNameKey(), c.getRefName()));
          break;

        case DELETE:
          break;
      }
    }
  }

  // Update superproject gitlinks if required.
  if (!branches.isEmpty()) {
    try (MergeOpRepoManager orm = ormProvider.get()) {
      orm.setContext(db, TimeUtil.nowTs(), user, receiveId);
      SubmoduleOp op = subOpFactory.create(branches, orm);
      op.updateSuperProjects();
    } catch (SubmoduleException e) {
      logError("Can't update the superprojects", e);
    }
  }

  // Update account info with details discovered during commit walking.
  updateAccountInfo();

  closeProgress.end();
  commandProgress.end();
  progress.end();
  reportMessages();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:76,代码来源:ReceiveCommits.java

示例2: Command

import org.eclipse.jgit.transport.ReceiveCommand; //导入方法依赖的package包/类
private Command(ReceiveCommand receiveCommand) {
  this.refName = receiveCommand.getRefName();
  this.type = receiveCommand.getType();
}
 
开发者ID:kamegu,项目名称:git-webapp,代码行数:5,代码来源:GwReceiveHook.java


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