use of com.google.gerrit.extensions.common.ChangeInfoDifference in project gerrit by GerritCodeReview.
the class GetMetaDiffIT method metaDiffWithOptionIncludesExtraInformation.
@Test
public void metaDiffWithOptionIncludesExtraInformation() throws Exception {
PushOneCommit.Result ch = createChange();
ChangeApi chApi = gApi.changes().id(ch.getChangeId());
ChangeInfo oldInfo = chApi.get(ListChangesOption.CURRENT_REVISION);
amendChange(ch.getChangeId());
ChangeInfo newInfo = chApi.get(ListChangesOption.CURRENT_REVISION);
ChangeInfoDifference difference = chApi.metaDiff(oldInfo.metaRevId, newInfo.metaRevId, ImmutableSet.of(ListChangesOption.CURRENT_REVISION));
assertThat(newInfo.currentRevision).isNotNull();
assertThat(oldInfo.currentRevision).isNotNull();
assertThat(difference.added().currentRevision).isEqualTo(newInfo.currentRevision);
assertThat(difference.removed().currentRevision).isEqualTo(oldInfo.currentRevision);
}
use of com.google.gerrit.extensions.common.ChangeInfoDifference in project gerrit by GerritCodeReview.
the class GetMetaDiffIT method metaDiffWithoutOptionDoesNotIncludeExtraInformation.
@Test
public void metaDiffWithoutOptionDoesNotIncludeExtraInformation() throws Exception {
PushOneCommit.Result ch = createChange();
ChangeApi chApi = gApi.changes().id(ch.getChangeId());
ChangeInfo oldInfo = chApi.get();
amendChange(ch.getChangeId());
ChangeInfo newInfo = chApi.get();
ChangeInfoDifference difference = chApi.metaDiff(oldInfo.metaRevId, newInfo.metaRevId);
assertThat(difference.added().currentRevision).isNull();
assertThat(difference.removed().currentRevision).isNull();
}
use of com.google.gerrit.extensions.common.ChangeInfoDifference in project gerrit by GerritCodeReview.
the class GetMetaDiffIT method metaDiffWithOldSha1NotInRepoUsesDefault.
@Test
public void metaDiffWithOldSha1NotInRepoUsesDefault() throws Exception {
PushOneCommit.Result ch = createChange();
gApi.changes().id(ch.getChangeId()).topic("intermediate-topic");
gApi.changes().id(ch.getChangeId()).topic(TOPIC);
ChangeInfo info = gApi.changes().id(ch.getChangeId()).get();
ChangeInfoDifference difference = gApi.changes().id(ch.getChangeId()).metaDiff(UNSAVED_REV_ID, info.metaRevId);
assertThat(difference.added().topic).isEqualTo(TOPIC);
assertThat(difference.removed().topic).isNull();
}
use of com.google.gerrit.extensions.common.ChangeInfoDifference in project gerrit by GerritCodeReview.
the class GetMetaDiffIT method metaDiffUnreachableOldSha1UsesDefault.
@Test
public void metaDiffUnreachableOldSha1UsesDefault() throws Exception {
PushOneCommit.Result ch1 = createChange();
PushOneCommit.Result ch2 = createChange();
gApi.changes().id(ch1.getChangeId()).topic("intermediate-topic");
gApi.changes().id(ch1.getChangeId()).topic(TOPIC);
ChangeInfo info1 = gApi.changes().id(ch1.getChangeId()).get();
ChangeInfo info2 = gApi.changes().id(ch2.getChangeId()).get();
ChangeInfoDifference difference = gApi.changes().id(ch1.getChangeId()).metaDiff(info2.metaRevId, info1.metaRevId);
assertThat(difference.added().topic).isEqualTo(TOPIC);
assertThat(difference.removed().topic).isNull();
}
use of com.google.gerrit.extensions.common.ChangeInfoDifference in project gerrit by GerritCodeReview.
the class GetMetaDiffIT method metaDiffNoOldMetaGivenUsesPatchSetBeforeNew.
@Test
public void metaDiffNoOldMetaGivenUsesPatchSetBeforeNew() throws Exception {
PushOneCommit.Result ch = createChange();
ChangeApi chApi = gApi.changes().id(ch.getChangeId());
chApi.topic(TOPIC);
ChangeInfo newInfo = chApi.get();
chApi.topic(TOPIC + "2");
ChangeInfoDifference difference = chApi.metaDiff(null, newInfo.metaRevId);
assertThat(difference.added().topic).isEqualTo(TOPIC);
assertThat(difference.removed().topic).isNull();
}
Aggregations