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

login
register
mail settings
Submitter Kostia Balytskyi
Date Sept. 22, 2016, 4:10 p.m.
Message ID <ac125f907dfe8f85d0c2.1474560609@dev1902.lla1.facebook.com>
Download mbox | patch
Permalink /patch/16758/
State Rejected
Headers show

Comments

Kostia Balytskyi - Sept. 22, 2016, 4:10 p.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@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.
Pierre-Yves David - Sept. 23, 2016, 1:44 a.m.
On 09/22/2016 06:10 PM, Kostia Balytskyi wrote:
> # HG changeset patch
> # User Kostia Balytskyi <ikostia@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

Ryan fixed this in August fe64e69da57, it seems like you are using the 
stable branch.

(also, "evolve:" is a bit too wide as a prefix, "compat:" or "dirstate:" 
would have been better here).

Patch

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()