Patchwork [evolve-ext] dirstate: use arg count for version check

login
register
mail settings
Submitter Ryan McElroy
Date Aug. 8, 2016, 5:06 p.m.
Message ID <adfe8879faff27f4114b.1470675982@devbig314.prn1.facebook.com>
Download mbox | patch
Permalink /patch/16207/
State Accepted
Headers show

Comments

Ryan McElroy - Aug. 8, 2016, 5:06 p.m.
# HG changeset patch
# User Ryan McElroy <rmcelroy@fb.com>
# Date 1470675947 25200
#      Mon Aug 08 10:05:47 2016 -0700
# Node ID adfe8879faff27f4114bcb02950e08b58e4718d8
# Parent  6ff0454f1f230aaa62263515cb49b4e4c86dc50b
dirstate: use arg count for version check

In 52ff07e1de91 in the main hg repo, dirstate was changed to require a second
argument, making the default args check no longer work. Instead, we switch
to check the number of arguments, which should be backwards and forwards
compatible.
Pierre-Yves David - Aug. 8, 2016, 10:42 p.m.
On 08/08/2016 07:06 PM, Ryan McElroy wrote:
> # HG changeset patch
> # User Ryan McElroy <rmcelroy@fb.com>
> # Date 1470675947 25200
> #      Mon Aug 08 10:05:47 2016 -0700
> # Node ID adfe8879faff27f4114bcb02950e08b58e4718d8
> # Parent  6ff0454f1f230aaa62263515cb49b4e4c86dc50b
> dirstate: use arg count for version check

Pushed, thanks.

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 != 1: # mercurial 3.6 and above
         return dirstate.write(tr)
     return dirstate.write()