Ignore merge point candidates that create crosses

In OBS you can create submit requests for revisions that are behind
the last merge point, in git you can't - so we ignore them.

Fixes #14
This commit is contained in:
Stephan Kulow
2022-11-03 15:03:41 +01:00
parent ef7755c771
commit f2019db8ff
6 changed files with 20 additions and 11 deletions

View File

@@ -104,14 +104,23 @@ class TreeBuilder:
"""For a given revision in the target, find the node in the source chain
that matches the files"""
node = source_chain
candidates = []
while node:
# exclude reverts happening after the merge
if (
node.revision.commit_time <= revision.commit_time
and node.revision.files_hash == revision.files_hash
):
return node
candidates.append(node)
if node.merged_into:
# we can't have candidates that are crossing previous merges
# see https://gitea.opensuse.org/importers/git-importer/issues/14
candidates = []
node = node.parent
if candidates:
# the assert is here to see if we have more hot cases
assert len(candidates) == 1
return candidates[0]
def add_merge_points(self, factory_revisions):
"""For all target revisions that accepted a request, look up the merge