# HG changeset patch # User Georges Racinet <georges.racinet@octobus.net> # Date 1606651556 -3600 # Sun Nov 29 13:05:56 2020 +0100 # Node ID 37f8e3ebf3bd0327fc6ee82fa0c727b39a3d6197 # Parent 7e8120cddbaa802936e1f3198ef2788f5394a1e9 exportable heads finalization: more explict parameted names In the just extracted `branchmap_entry_process_finalize`, these more self-defining parameter names will avoid ambiguity. diff --git a/hgext3rd/heptapod/git.py b/hgext3rd/heptapod/git.py --- a/hgext3rd/heptapod/git.py +++ b/hgext3rd/heptapod/git.py @@ -282,14 +282,21 @@ allow_bookmarks=allow_bookmarks, to_prune=to_prune, ) - self.branchmap_entry_process_finalize(hg_shas=hg_shas, - git_refs=git_refs, - branch=branch, - logprefix=logprefix) + self.branchmap_entry_process_finalize( + hg_shas=hg_shas, + gitlab_refs=git_refs, + branchmap_branch=branch, + gitlab_branch=gb, + logprefix=logprefix + ) return git_refs - def branchmap_entry_process_finalize(self, hg_shas, git_refs, branch, + def branchmap_entry_process_finalize(self, + hg_shas, + gitlab_refs, + gitlab_branch, + branchmap_branch, logprefix=b""): """Final step of storing exportable values for the given branch. @@ -316,18 +323,18 @@ # that is disabled in Heptapod just to avoid calling # the expensive _filter_obsolete_heads twice per branch msg = _(b'rejecting multiple heads on branch "%s"') - msg %= branch + msg %= branchmap_branch hint = _(b'%d heads: %s') hint %= (len(hg_shas), scmutil.nodesummaries(repo, hg_shas)) raise error.Abort(msg, hint=hint) ui.note(logprefix, b"Multiple heads for branch '%s': %r" % ( - branch, util.format_bytes_list(hg_shas))) + branchmap_branch, util.format_bytes_list(hg_shas))) for hg_sha in hg_shas: - git_refs[hg_sha].heads.add( + gitlab_refs[hg_sha].heads.add( git_branch_ref(b'wild/' + hg_sha)) - gca = self.multiple_heads_choose(hg_shas, branch) + gca = self.multiple_heads_choose(hg_shas, branchmap_branch) if gca is None: # giving up in order to avoid confusing situations return @@ -335,11 +342,11 @@ ui.note(logprefix, b"Chose %s out of multiple heads %s " b"for forwarding branch %r" % ( - gca_sha, util.format_bytes_list(hg_shas), branch)) + gca_sha, util.format_bytes_list(hg_shas), + branchmap_branch)) hg_shas = [gca_sha] hg_sha = hg_shas.pop() - gb = self.git_branch_for_branchmap_branch(branch) - git_refs[hg_sha].heads.add(git_branch_ref(gb)) + gitlab_refs[hg_sha].heads.add(git_branch_ref(gitlab_branch)) def published_topic_latest_hg_sha(self, topic, ctx, log_before_ctx=None): """Rewrapping of `latest_topic_descendant` returning hg sha.