compat: call current obsolete.createmarkers(), not one from load time stable
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 23 Mar 2018 09:08:21 -0700
branchstable
changeset 3611 c912eaf29eec
parent 3601 1cfca1b4f518
child 3668 a6bac0492eff
child 3703 07e97b3aef48
child 3704 a0c39e8d2c29
compat: call current obsolete.createmarkers(), not one from load time Other extensions may wrap obsolete.createmarkers(). If they do, we should call their wrapped version. However, since f61a23a84dac (compat: add wrapper for obsolete.createmarkers() that accepts "operation" arg, 2018-03-16), we started storing the version of the function as it was when our compat module was loaded. This broke an extension we use internally at Google.
hgext3rd/evolve/compat.py
hgext3rd/topic/compat.py
--- a/hgext3rd/evolve/compat.py	Thu Mar 22 09:53:42 2018 +0100
+++ b/hgext3rd/evolve/compat.py	Fri Mar 23 09:08:21 2018 -0700
@@ -55,14 +55,16 @@
 
 # Wrap obsolete.creatmarkers and make it accept but ignore "operation" argument
 # for hg < 4.3
-createmarkers = obsolete.createmarkers
-originalcreatemarkers = createmarkers
+originalcreatemarkers = obsolete.createmarkers
 while isinstance(originalcreatemarkers, functools.partial):
     originalcreatemarkers = originalcreatemarkers.func
 if originalcreatemarkers.__code__.co_argcount < 6:
     def createmarkers(repo, relations, flag=0, date=None, metadata=None,
                       operation=None):
         return obsolete.createmarkers(repo, relations, flag, date, metadata)
+else:
+    def createmarkers(*args, **kwargs):
+        return obsolete.createmarkers(*args, **kwargs)
 
 if not util.safehasattr(hg, '_copycache'):
     # exact copy of relevantmarkers as in Mercurial-176d1a0ce385
--- a/hgext3rd/topic/compat.py	Thu Mar 22 09:53:42 2018 +0100
+++ b/hgext3rd/topic/compat.py	Fri Mar 23 09:08:21 2018 -0700
@@ -31,14 +31,16 @@
 
 # Wrap obsolete.creatmarkers and make it accept but ignore "operation" argument
 # for hg < 4.3
-createmarkers = obsolete.createmarkers
-originalcreatemarkers = createmarkers
+originalcreatemarkers = obsolete.createmarkers
 while isinstance(originalcreatemarkers, functools.partial):
     originalcreatemarkers = originalcreatemarkers.func
 if originalcreatemarkers.__code__.co_argcount < 6:
     def createmarkers(repo, relations, flag=0, date=None, metadata=None,
                       operation=None):
         return obsolete.createmarkers(repo, relations, flag, date, metadata)
+else:
+    def createmarkers(*args, **kwargs):
+        return obsolete.createmarkers(*args, **kwargs)
 
 def startpager(ui, cmd):
     """function to start a pager in case ui.pager() exists"""