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


Java ListChangesOption类代码示例

本文整理汇总了Java中com.google.gerrit.extensions.client.ListChangesOption的典型用法代码示例。如果您正苦于以下问题:Java ListChangesOption类的具体用法?Java ListChangesOption怎么用?Java ListChangesOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onLoad

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Override
protected void onLoad() {
  if (!loaded) {
    RestApi call = ChangeApi.detail(project.get(), changeId.get());
    ChangeList.addOptions(
        call, EnumSet.of(ListChangesOption.ALL_COMMITS, ListChangesOption.ALL_REVISIONS));
    call.get(
        new AsyncCallback<ChangeInfo>() {
          @Override
          public void onSuccess(ChangeInfo result) {
            if (edit != null) {
              edit.setName(edit.commit().commit());
              result.revisions().put(edit.name(), RevisionInfo.fromEdit(edit));
            }
            render(result.revisions());
            loaded = true;
          }

          @Override
          public void onFailure(Throwable caught) {}
        });
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:24,代码来源:PatchSetsBox.java

示例2: updateMessage

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Test
public void updateMessage() throws Exception {
  createEmptyEditFor(changeId);
  String msg = String.format("New commit message\n\nChange-Id: %s\n", changeId);
  gApi.changes().id(changeId).edit().modifyCommitMessage(msg);
  String commitMessage = gApi.changes().id(changeId).edit().getCommitMessage();
  assertThat(commitMessage).isEqualTo(msg);

  PublishChangeEditInput publishInput = new PublishChangeEditInput();
  publishInput.notify = NotifyHandling.NONE;
  gApi.changes().id(changeId).edit().publish(publishInput);
  assertThat(getEdit(changeId)).isAbsent();

  ChangeInfo info =
      get(changeId, ListChangesOption.CURRENT_COMMIT, ListChangesOption.CURRENT_REVISION);
  assertThat(info.revisions.get(info.currentRevision).commit.message).isEqualTo(msg);
  assertThat(info.revisions.get(info.currentRevision).description)
      .isEqualTo("Edit commit message");

  assertChangeMessages(
      changeId,
      ImmutableList.of(
          "Uploaded patch set 1.",
          "Uploaded patch set 2.",
          "Patch Set 3: Commit message was updated."));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:ChangeEditIT.java

示例3: returnsCurrentFilesIfOptionRequested

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Test
public void returnsCurrentFilesIfOptionRequested() throws Exception {
  RevCommit c1_1 = commitBuilder().add("a.txt", "1").message("subject: 1").create();
  RevCommit c2_1 = commitBuilder().add("b.txt", "2").message("subject: 2").create();
  String id2 = getChangeId(c2_1);
  pushHead(testRepo, "refs/for/master", false);

  SubmittedTogetherInfo info =
      gApi.changes()
          .id(id2)
          .submittedTogether(
              EnumSet.of(ListChangesOption.CURRENT_FILES), EnumSet.of(NON_VISIBLE_CHANGES));
  assertThat(info.changes).hasSize(2);
  assertThat(info.changes.get(0).currentRevision).isEqualTo(c2_1.name());
  assertThat(info.changes.get(1).currentRevision).isEqualTo(c1_1.name());

  RevisionInfo rev = info.changes.get(0).revisions.get(c2_1.name());
  assertThat(rev).isNotNull();
  FileInfo file = rev.files.get("b.txt");
  assertThat(file).isNotNull();
  assertThat(file.status).isEqualTo('A');
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:23,代码来源:SubmittedTogetherIT.java

示例4: QueryChanges

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Inject
QueryChanges(ChangeJson.Factory json, ChangeQueryBuilder qb, ChangeQueryProcessor qp) {
  this.json = json;
  this.qb = qb;
  this.imp = qp;

  options = EnumSet.noneOf(ListChangesOption.class);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:QueryChanges.java

示例5: submittedTogether

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Override
public List<ChangeInfo> submittedTogether() throws RestApiException {
  SubmittedTogetherInfo info =
      submittedTogether(
          EnumSet.noneOf(ListChangesOption.class), EnumSet.noneOf(SubmittedTogetherOption.class));
  return info.changes;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:ChangeApiImpl.java

示例6: get

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Override
public ChangeInfo get(EnumSet<ListChangesOption> s) throws RestApiException {
  try {
    return changeJson.create(s).format(change);
  } catch (Exception e) {
    throw asRestApiException("Cannot retrieve change", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:ChangeApiImpl.java

示例7: get

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
private List<ChangeInfo> get(QueryRequest q) throws RestApiException {
  QueryChanges qc = queryProvider.get();
  if (q.getQuery() != null) {
    qc.addQuery(q.getQuery());
  }
  qc.setLimit(q.getLimit());
  qc.setStart(q.getStart());
  for (ListChangesOption option : q.getOptions()) {
    qc.addOption(option);
  }

  try {
    List<?> result = qc.apply(TopLevelResource.INSTANCE);
    if (result.isEmpty()) {
      return ImmutableList.of();
    }

    // Check type safety of result; the extension API should be safer than the
    // REST API in this case, since it's intended to be used in Java.
    Object first = checkNotNull(result.iterator().next());
    checkState(first instanceof ChangeInfo);
    @SuppressWarnings("unchecked")
    List<ChangeInfo> infos = (List<ChangeInfo>) result;

    return ImmutableList.copyOf(infos);
  } catch (Exception e) {
    throw asRestApiException("Cannot query changes", e);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:30,代码来源:ChangesImpl.java

示例8: GetDetail

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Inject
GetDetail(GetChange delegate) {
  this.delegate = delegate;
  delegate.addOption(ListChangesOption.LABELS);
  delegate.addOption(ListChangesOption.DETAILED_LABELS);
  delegate.addOption(ListChangesOption.DETAILED_ACCOUNTS);
  delegate.addOption(ListChangesOption.MESSAGES);
  delegate.addOption(ListChangesOption.REVIEWER_UPDATES);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:GetDetail.java

示例9: loadChangeInfo

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
void loadChangeInfo(boolean fg, AsyncCallback<ChangeInfo> cb) {
  RestApi call = ChangeApi.detail(Project.NameKey.asStringOrNull(project), changeId.get());
  EnumSet<ListChangesOption> opts =
      EnumSet.of(ListChangesOption.ALL_REVISIONS, ListChangesOption.CHANGE_ACTIONS);
  if (enableSignedPush()) {
    opts.add(ListChangesOption.PUSH_CERTIFICATES);
  }
  ChangeList.addOptions(call, opts);
  if (!fg) {
    call.background();
  }
  call.get(cb);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:ChangeScreen.java

示例10: setForOpenChange

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
private void setForOpenChange(ChangeInfo info, String revision) {
  if (info.mergeable()) {
    StringBuilder conflictsQuery = new StringBuilder();
    conflictsQuery.append("status:open");
    conflictsQuery.append(" is:mergeable");
    conflictsQuery.append(" ").append(op("conflicts", info.legacyId().get()));
    ChangeList.query(
        conflictsQuery.toString(),
        EnumSet.of(ListChangesOption.CURRENT_REVISION, ListChangesOption.CURRENT_COMMIT),
        new TabChangeListCallback(Tab.CONFLICTING_CHANGES, info.project(), revision));
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:13,代码来源:RelatedChanges.java

示例11: queryMultiple

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
/** Run multiple queries in a single remote invocation. */
public static void queryMultiple(
    final AsyncCallback<JsArray<ChangeList>> callback,
    Set<ListChangesOption> options,
    String... queries) {
  if (queries.length == 0) {
    return;
  }
  RestApi call = new RestApi(URI);
  for (String q : queries) {
    call.addParameterRaw("q", KeyUtil.encode(q));
  }
  addOptions(call, options);
  if (queries.length == 1) {
    // Server unwraps a single query, so wrap it back in an array for the
    // callback.
    call.get(
        new AsyncCallback<ChangeList>() {
          @Override
          public void onSuccess(ChangeList result) {
            JsArray<ChangeList> wrapped = JsArray.createArray(1).cast();
            wrapped.set(0, result);
            callback.onSuccess(wrapped);
          }

          @Override
          public void onFailure(Throwable caught) {
            callback.onFailure(caught);
          }
        });
  } else {
    call.get(callback);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:35,代码来源:ChangeList.java

示例12: createChangeForMergedCommit

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Test
public void createChangeForMergedCommit() throws Exception {
  String master = "refs/heads/master";
  grant(project, master, Permission.PUSH, true);

  // Update master with a direct push.
  RevCommit c1 = testRepo.commit().message("Non-change 1").create();
  RevCommit c2 =
      testRepo.parseBody(
          testRepo.commit().parent(c1).message("Non-change 2").insertChangeId().create());
  String changeId = Iterables.getOnlyElement(c2.getFooterLines(CHANGE_ID));

  testRepo.reset(c2);
  assertPushOk(pushHead(testRepo, master, false, true), master);

  String q = "commit:" + c1.name() + " OR commit:" + c2.name() + " OR change:" + changeId;
  assertThat(gApi.changes().query(q).get()).isEmpty();

  // Push c2 as a merged change.
  String r = "refs/for/master%merged";
  assertPushOk(pushHead(testRepo, r, false), r);

  EnumSet<ListChangesOption> opts = EnumSet.of(ListChangesOption.CURRENT_REVISION);
  ChangeInfo info = gApi.changes().id(changeId).get(opts);
  assertThat(info.currentRevision).isEqualTo(c2.name());
  assertThat(info.status).isEqualTo(ChangeStatus.MERGED);

  // Only c2 was created as a change.
  String q1 = "commit: " + c1.name();
  assertThat(gApi.changes().query(q1).get()).isEmpty();

  // Push c1 as a merged change.
  testRepo.reset(c1);
  assertPushOk(pushHead(testRepo, r, false), r);
  List<ChangeInfo> infos = gApi.changes().query(q1).withOptions(opts).get();
  assertThat(infos).hasSize(1);
  info = infos.get(0);
  assertThat(info.currentRevision).isEqualTo(c1.name());
  assertThat(info.status).isEqualTo(ChangeStatus.MERGED);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:41,代码来源:AbstractPushForReview.java

示例13: submitDependentConflictingChangesOutOfOrder

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Test
public void submitDependentConflictingChangesOutOfOrder() throws Exception {
  RevCommit initialHead = getRemoteHead();

  testRepo.reset(initialHead);
  PushOneCommit.Result change = createChange("Change 1", "b", "b1");
  PushOneCommit.Result change2 = createChange("Change 2", "b", "b2");
  assertThat(change2.getCommit().getParent(0)).isEqualTo(change.getCommit());

  // Submit fails; change2 contains the delta "b1" -> "b2", which cannot be
  // applied against tip.
  submitWithConflict(
      change2.getChangeId(),
      "Failed to submit 1 change due to the following problems:\n"
          + "Change "
          + change2.getChange().getId()
          + ": Change could not be "
          + "merged due to a path conflict. Please rebase the change locally and "
          + "upload the rebased commit for review.");

  ChangeInfo info3 = get(change2.getChangeId(), ListChangesOption.MESSAGES);
  assertThat(info3.status).isEqualTo(ChangeStatus.NEW);

  // Tip has not changed.
  List<RevCommit> log = getRemoteLog();
  assertThat(log.get(0)).isEqualTo(initialHead.getId());
  assertNoSubmitter(change2.getChangeId(), 1);

  assertRefUpdatedEvents();
  assertChangeMergedEvents();
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:32,代码来源:SubmitByCherryPickIT.java

示例14: allChangeOptionsAreServedWithoutExceptions

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
@Test
public void allChangeOptionsAreServedWithoutExceptions() throws Exception {
  PushOneCommit.Result r = createChange();
  // Merge the change so that the result has more data and potentially went through more
  // computation while formatting the output, such as labels, reviewers etc.
  merge(r);
  for (ListChangesOption option : ListChangesOption.values()) {
    assertThat(gApi.changes().query(r.getChangeId()).withOption(option).get())
        .named("Option: " + option)
        .hasSize(1);
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:13,代码来源:QueryIT.java

示例15: get

import com.google.gerrit.extensions.client.ListChangesOption; //导入依赖的package包/类
private List<ChangeInfo> get(QueryRequest queryRequest) throws RestApiException {
    String query = "";

    if (!Strings.isNullOrEmpty(queryRequest.getQuery())) {
        query = UrlUtils.appendToUrlQuery(query, "q=" + queryRequest.getQuery());
    }
    if (queryRequest.getLimit() > 0) {
        query = UrlUtils.appendToUrlQuery(query, "n=" + queryRequest.getLimit());
    }
    if (queryRequest.getStart() > 0) {
        query = UrlUtils.appendToUrlQuery(query, "S=" + queryRequest.getStart());
    }
    // server version < 2.9, needed for change list paging
    if (!Strings.isNullOrEmpty(queryRequest.getSortkey())) {
        query = UrlUtils.appendToUrlQuery(query, "N=" + queryRequest.getSortkey());
    }
    for (ListChangesOption option : queryRequest.getOptions()) {
        query = UrlUtils.appendToUrlQuery(query, "o=" + option);
    }

    String url = "/changes/";
    if (!Strings.isNullOrEmpty(query)) {
        url += '?' + query;
    }

    JsonElement jsonElement = gerritRestClient.getRequest(url);
    return changesParser.parseChangeInfos(jsonElement);
}
 
开发者ID:uwolfer,项目名称:gerrit-rest-java-client,代码行数:29,代码来源:ChangesRestClient.java


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