[PATCH evolve-ext] evolve: fix the way evolve checks whether dirstate.write has arguments

Kostia Balytskyi ikostia at fb.com
Thu Sep 22 16:10:09 UTC 2016


# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1474560467 25200
#      Thu Sep 22 09:07:47 2016 -0700
# Branch stable
# Node ID ac125f907dfe8f85d0c2771b3f71eaec788d9ea0
# Parent  8f902ec9ed9a296d92c2c2df1536af8c44b5321c
evolve: fix the way evolve checks whether dirstate.write has arguments


Earlier dirstate.write had the following signature: def write(self, tr=_token)
Since it had a default argument, func_defaults would list it.
In 52ff07e1de9150a8cec8e6cbe02125fb67978b8d the signature was changed to be
def write(self, tr), thus making the func_defaults check incorrect. This breaks
some evolve tests.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1024,7 +1024,7 @@ def bmactive(repo):
 ### dirstate compatibility layer < hg 3.6
 
 def writedirstate(dirstate, tr):
-    if dirstate.write.func_defaults is not None: # mercurial 3.6 and above
+    if dirstate.write.func_code.co_argcount: # mercurial 3.6 and above
         return dirstate.write(tr)
     return dirstate.write()
 


More information about the Mercurial-devel mailing list