diff hgext3rd/topic/topicmap.py @ 5665:dd9dba7c1d00

compat: make topics compatible across change to cmdutil.commitstatus() `cmdutil.commitstatus()` was changed in https://phab.mercurial-scm.org/D9257 so it has a new `tip` argument. This patch adds compatibility with that. It was harder than I expected because the callers all pass the arguments as positional, so we can't look for `opts` or `tip` in the `kwargs`. I instead extracted much of the override to a helper. I think the result is okay.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 16 Nov 2020 13:08:08 -0800
parents 86736040b0ec
children ad7c9c0b7a63
line wrap: on
line diff
--- a/hgext3rd/topic/topicmap.py	Thu Oct 29 09:19:37 2020 -0700
+++ b/hgext3rd/topic/topicmap.py	Mon Nov 16 13:08:08 2020 -0800
@@ -6,7 +6,6 @@
 from mercurial import (
     branchmap,
     changegroup,
-    cmdutil,
     extensions,
     repoview,
     util,
@@ -89,20 +88,20 @@
     _setuptopicfilter(ui)
     _wrapbmcache(ui)
     extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply)
-    extensions.wrapfunction(cmdutil, 'commitstatus', commitstatus)
+    compat.overridecommitstatus(commitstatus)
 
 def cgapply(orig, self, repo, *args, **kwargs):
     """make sure a topicmap is used when applying a changegroup"""
     other = repo.filtered(topicfilter(repo.filtername))
     return orig(self, other, *args, **kwargs)
 
-def commitstatus(orig, repo, node, branch, bheads=None, opts=None):
+def commitstatus(orig, repo, node, branch, bheads=None, tip=None, opts=None):
     # wrap commit status use the topic branch heads
     ctx = repo[node]
     if ctx.topic() and ctx.branch() == branch:
         bheads = repo.branchheads(b"%s:%s" % (branch, ctx.topic()))
 
-    ret = orig(repo, node, branch, bheads=bheads, opts=opts)
+    ret = orig(repo, node, branch, bheads=bheads, tip=tip, opts=opts)
 
     # logic copy-pasted from cmdutil.commitstatus()
     if opts is None: