Fix Revert Submission related changes
The endpoint "Get Related Changes" searches for related changes based on groups predicate, rather than by relation. We need to insert the same group for related changes when cherry-picking one change on top of another. This change unfortunately doesn't actually solve the full problem of cherry-picks, since it's not always straightforward to infer the group of the parent when performing a cherry-pick. However, this change does fix the problem for Revert Submission: We ensure here that all changes that are cherry-picked in the same project+ branch will have the same group. Change-Id: Iabd8eaae7840aaa810822f0418ee8ad0fa22506b
This commit is contained in:
@@ -756,6 +756,8 @@ public class RevertIT extends AbstractDaemonTest {
|
||||
assertThat(revertChanges.get(i).get().topic)
|
||||
.startsWith("revert-" + resultCommits.get(0).getChange().change().getSubmissionId());
|
||||
}
|
||||
|
||||
assertThat(gApi.changes().id(revertChanges.get(1).id()).current().related().changes).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -792,6 +794,7 @@ public class RevertIT extends AbstractDaemonTest {
|
||||
assertThat(revertChanges.get(1).current().files().get("a.txt").linesDeleted).isEqualTo(1);
|
||||
|
||||
assertThat(revertChanges).hasSize(2);
|
||||
assertThat(gApi.changes().id(revertChanges.get(0).id()).current().related().changes).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -820,6 +823,7 @@ public class RevertIT extends AbstractDaemonTest {
|
||||
assertThat(revertChanges.get(1).current().files().get("a.txt").linesDeleted).isEqualTo(1);
|
||||
|
||||
assertThat(revertChanges).hasSize(2);
|
||||
assertThat(gApi.changes().id(revertChanges.get(0).id()).current().related().changes).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -892,6 +896,7 @@ public class RevertIT extends AbstractDaemonTest {
|
||||
.isEqualTo(sha1SecondRevert);
|
||||
|
||||
assertThat(revertChanges).hasSize(3);
|
||||
assertThat(gApi.changes().id(revertChanges.get(1).id()).current().related().changes).hasSize(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -940,6 +945,7 @@ public class RevertIT extends AbstractDaemonTest {
|
||||
.isEqualTo(sha1SecondRevert);
|
||||
|
||||
assertThat(revertChanges).hasSize(3);
|
||||
assertThat(gApi.changes().id(revertChanges.get(1).id()).current().related().changes).hasSize(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -989,6 +995,7 @@ public class RevertIT extends AbstractDaemonTest {
|
||||
.isEqualTo(sha1SecondRevert);
|
||||
|
||||
assertThat(revertChanges).hasSize(3);
|
||||
assertThat(gApi.changes().id(revertChanges.get(1).id()).current().related().changes).hasSize(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user