Don't compare commit message against auto-merge commit

When a merge commit is compared against its auto-merge commit, we want
to show the complete commit message as new in the diff screen (the
same as when the commit is compared against a parent commit).

Define a new class ComparisonType that encapsulates the information
about whether the comparison is done against a parent or against the
auto-merge.

If the comparison is done against a parent, include the parent number.
The parent number will be needed if we want to have magic files with
content that depends on the parent against which the comparison is
done. Include the parent number already now, so that we don't need to
invalidate the PatchListCache later once more.

Commenting on the auto-merge commit message is no longer possible.
Old comments that were done on the auto-merge commit message are
filtered out when comments are retrieved (because we don't return any
content to which they could be applied).

Change-Id: I8a75c32a2053f82f8a2f41e0d15747c7f50354c3
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-09-12 17:16:08 +02:00
parent 6647c6c7cb
commit c4ced8910f
11 changed files with 179 additions and 32 deletions

View File

@@ -547,21 +547,26 @@ public abstract class AbstractDaemonTest {
protected PushOneCommit.Result createMergeCommitChange(String ref)
throws Exception {
return createMergeCommitChange(ref, "foo");
}
protected PushOneCommit.Result createMergeCommitChange(String ref, String file)
throws Exception {
ObjectId initial = repo().exactRef(HEAD).getLeaf().getObjectId();
PushOneCommit.Result p1 = pushFactory.create(db, admin.getIdent(),
testRepo, "parent 1", ImmutableMap.of("foo", "foo-1", "bar", "bar-1"))
testRepo, "parent 1", ImmutableMap.of(file, "foo-1", "bar", "bar-1"))
.to(ref);
// reset HEAD in order to create a sibling of the first change
testRepo.reset(initial);
PushOneCommit.Result p2 = pushFactory.create(db, admin.getIdent(),
testRepo, "parent 2", ImmutableMap.of("foo", "foo-2", "bar", "bar-2"))
testRepo, "parent 2", ImmutableMap.of(file, "foo-2", "bar", "bar-2"))
.to(ref);
PushOneCommit m = pushFactory.create(db, admin.getIdent(), testRepo, "merge",
ImmutableMap.of("foo", "foo-1", "bar", "bar-2"));
ImmutableMap.of(file, "foo-1", "bar", "bar-2"));
m.setParents(ImmutableList.of(p1.getCommit(), p2.getCommit()));
PushOneCommit.Result result = m.to(ref);
result.assertOkStatus();