changeset 3611:c912eaf29eec stable

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.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 23 Mar 2018 09:08:21 -0700
parents 1cfca1b4f518
children a6bac0492eff 07e97b3aef48 a0c39e8d2c29
files hgext3rd/evolve/compat.py hgext3rd/topic/compat.py
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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"""