Return project in GetRelated
This commit adds project as a mandatory return field in RelatedChangeAndCommitInfo returned by GetRelated to fix a bug where links to related changes would have 'undefined' as the project component. Since we now always want to have the project along the change number it seems to be a good practice to also return the project along with a change number in the API similar to ChangeInfo. Bug: Issue 6876 Change-Id: I64ac0d1b30a3b8034cf16afe96c9d1168cbde193
This commit is contained in:
@@ -563,9 +563,10 @@ public class GetRelatedIT extends AbstractDaemonTest {
|
||||
return Iterables.getOnlyElement(queryProvider.get().byCommit(c));
|
||||
}
|
||||
|
||||
private static ChangeAndCommit changeAndCommit(
|
||||
private ChangeAndCommit changeAndCommit(
|
||||
PatchSet.Id psId, ObjectId commitId, int currentRevisionNum) {
|
||||
ChangeAndCommit result = new ChangeAndCommit();
|
||||
result.project = project.get();
|
||||
result._changeNumber = psId.getParentKey().get();
|
||||
result.commit = new CommitInfo();
|
||||
result.commit.commit = commitId.name();
|
||||
@@ -599,6 +600,7 @@ public class GetRelatedIT extends AbstractDaemonTest {
|
||||
String name = "index " + i + " related to " + psId;
|
||||
ChangeAndCommit a = actual.get(i);
|
||||
ChangeAndCommit e = expected[i];
|
||||
assertThat(a.project).named("project of " + name).isEqualTo(e.project);
|
||||
assertThat(a._changeNumber).named("change ID of " + name).isEqualTo(e._changeNumber);
|
||||
// Don't bother checking changeId; assume _changeNumber is sufficient.
|
||||
assertThat(a._revisionNumber).named("revision of " + name).isEqualTo(e._revisionNumber);
|
||||
|
||||
Reference in New Issue
Block a user