Bug 1617805 - Don't prune hg revs that are referenced by git tags as boring. r=kvark

The git repo may have tags of the form 'mozilla-<rev>' which tell the
converter script that the git commit is synced from given mozilla-central
hg rev. Those git commits are likely to be created manually from mozilla-central
push heads, which may or may not contain changes to the code being synced.
In this instance, the push head being referenced by tag did not contain changes,
and so the rev was pruned as uninteresting to the conversion. This led to a
busted graph and failure during git commit building.

This patch ensures that any hg rev referenced by a git commit doesn't get
pruned as boring, and so can be used as a base to build additional git commits
on top of.

Differential Revision: https://phabricator.services.mozilla.com/D64135

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kartikaya Gupta 2020-02-25 16:56:31 +00:00
parent c49a7308d8
commit 4fe1ed2688

View File

@ -162,7 +162,8 @@ def get_real_base_hg_rev(hg_data, commit_map):
# Now we prune out all the uninteresting changesets from hg_commits. The # Now we prune out all the uninteresting changesets from hg_commits. The
# uninteresting ones are ones that don't touch the target code and are not merges. # uninteresting ones are ones that don't touch the target code, are not merges,
# and are not referenced by mozilla tags in the git repo.
# We do this by rewriting the parents to the "interesting" ancestor. # We do this by rewriting the parents to the "interesting" ancestor.
def prune_boring(rev): def prune_boring(rev):
while rev in hg_commits: while rev in hg_commits:
@ -175,6 +176,8 @@ def prune_boring(rev):
continue continue
if len(hg_commits[parent_rev].parents) > 1: if len(hg_commits[parent_rev].parents) > 1:
continue continue
if parent_rev in hg_to_git_commit_map:
continue
# If we get here, then `parent_rev` is a boring revision and we can # If we get here, then `parent_rev` is a boring revision and we can
# prune it. Connect `rev` to its grandparent, and prune the parent # prune it. Connect `rev` to its grandparent, and prune the parent