Handle multiple non-contributing commits being merged
When encountering multiple non-contributing commits included in a merge that is TREESAME to the existing contents, ensure a list of all commits being brought in by that merge are included in the list to be pruned from history. Change-Id: I643e0923f8967f9b70d10b8796688b782681bfe0 Closes-Bug: #1648029
This commit is contained in:
parent
ccae7b1a63
commit
6415738c1c
|
@ -132,10 +132,15 @@ class Searcher(GitMixin):
|
|||
# happens to be in a list of commits directly between the tip and
|
||||
# previous upstream import, then it is simply a merge of an obsolete
|
||||
# commit. These are very difficult to strip out normally
|
||||
if any(self.git.merge_base(
|
||||
parent, p, with_exceptions=False) in ancestry_commits
|
||||
for p in other_parents):
|
||||
return None, [], other_parents
|
||||
exclude_commits = []
|
||||
for p in other_parents:
|
||||
if self.git.merge_base(
|
||||
p, parent, with_exceptions=False) in ancestry_commits:
|
||||
exclude_commits.extend(
|
||||
self.git.rev_list("%s..%s" % (parent, p)).splitlines())
|
||||
|
||||
if exclude_commits:
|
||||
return None, [], exclude_commits
|
||||
|
||||
# otherwise looking at the previous import merge commit and the parent
|
||||
# from the previous import branch, so exclude all other parents.
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
Repository layout being tested
|
||||
|
||||
O------------
|
||||
O---P--------
|
||||
/ \
|
||||
B---C---D---G---H---I---J---K master
|
||||
/ /
|
||||
|
@ -26,6 +26,7 @@
|
|||
- [B, [A]]
|
||||
- [C, [B]]
|
||||
- [O, [C]]
|
||||
- [P, [O]]
|
||||
- [D, [C]]
|
||||
- [E, [A]]
|
||||
- [F, [E]]
|
||||
|
@ -35,7 +36,7 @@
|
|||
- [D1, [C1]]
|
||||
- [H, [G, =D1]]
|
||||
# next node definition ensures I is TREESAME to H
|
||||
- [I, [=H, O]]
|
||||
- [I, [=H, P]]
|
||||
- [J, [I]]
|
||||
- [K, [J]]
|
||||
- [L, [F]]
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
Repository layout being tested
|
||||
|
||||
O----
|
||||
O---P
|
||||
/ \
|
||||
B---C---D---G---H master
|
||||
/
|
||||
|
@ -24,10 +24,11 @@
|
|||
- [B, [A]]
|
||||
- [C, [B]]
|
||||
- [O, [C]]
|
||||
- [P, [O]]
|
||||
- [D, [C]]
|
||||
- [E, [A]]
|
||||
- [F, [E]]
|
||||
- [G, [=D, O]]
|
||||
- [G, [=D, P]]
|
||||
- [H, [G]]
|
||||
- [L, [F]]
|
||||
- [M, [L]]
|
||||
|
|
Loading…
Reference in New Issue