From 4fe1ed2688735b17d47f1a41500d66616ac9627a Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Tue, 25 Feb 2020 16:56:31 +0000 Subject: [PATCH] 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-' 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 --- tools/github-sync/converter.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/github-sync/converter.py b/tools/github-sync/converter.py index c5fc604c0367..985901530ebb 100755 --- a/tools/github-sync/converter.py +++ b/tools/github-sync/converter.py @@ -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 -# 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. def prune_boring(rev): while rev in hg_commits: @@ -175,6 +176,8 @@ def prune_boring(rev): continue if len(hg_commits[parent_rev].parents) > 1: 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 # prune it. Connect `rev` to its grandparent, and prune the parent