Fix parsing of current patch set from notes branch
The current patch set is not always the patch that is mentioned in the head commit, e.g. it may be that as last action somebody commented on an old patch set. Change-Id: I45d5845838aec06c6bbe4087c1a9b7dd84f2e2e4 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
parent
6869c10a7e
commit
3a90257848
@ -207,7 +207,7 @@ class ChangeNotesParser implements AutoCloseable {
|
||||
}
|
||||
|
||||
PatchSet.Id psId = parsePatchSetId(commit);
|
||||
if (currentPatchSetId == null) {
|
||||
if (currentPatchSetId == null || psId.get() > currentPatchSetId.get()) {
|
||||
currentPatchSetId = psId;
|
||||
}
|
||||
|
||||
|
@ -633,6 +633,14 @@ public class ChangeNotesTest extends AbstractChangeNotesTest {
|
||||
assertThat(ps2.getRevision().get()).isEqualTo(commit.name());
|
||||
assertThat(ps2.getUploader()).isEqualTo(otherUser.getAccountId());
|
||||
assertThat(ps2.getCreatedOn()).isEqualTo(update.getWhen());
|
||||
|
||||
// comment on ps1, current patch set is still ps2
|
||||
update = newUpdate(c, changeOwner);
|
||||
update.setPatchSetId(ps1.getId());
|
||||
update.setChangeMessage("Comment on old patch set.");
|
||||
update.commit();
|
||||
notes = newNotes(c);
|
||||
assertThat(notes.getChange().currentPatchSetId()).isEqualTo(ps2.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user