Patchwork D4043: absorb: avoid mutable default arg

login
register
mail settings
Submitter phabricator
Date Aug. 6, 2018, 3:54 p.m.
Message ID <859a64a912fd28003f90beaaf125ad9e@localhost.localdomain>
Download mbox | patch
Permalink /patch/33335/
State Not Applicable
Headers show

Comments

phabricator - Aug. 6, 2018, 3:54 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2ac40e86f604: absorb: avoid mutable default arg (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4043?vs=9760&id=9987

REVISION DETAIL
  https://phab.mercurial-scm.org/D4043

AFFECTED FILES
  hgext/absorb.py

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/hgext/absorb.py b/hgext/absorb.py
--- a/hgext/absorb.py
+++ b/hgext/absorb.py
@@ -126,7 +126,7 @@ 
     result.reverse()
     return result
 
-def getfilestack(stack, path, seenfctxs=set()):
+def getfilestack(stack, path, seenfctxs=None):
     """([ctx], str, set) -> [fctx], {ctx: fctx}
 
     stack is a list of contexts, from old to new. usually they are what
@@ -163,6 +163,8 @@ 
     - if stack = [6, 7], returns ([1, 2], {6: 1, 7: 2}), although {6: 1} can be
       removed, since 1 is immutable.
     """
+    if seenfctxs is None:
+        seenfctxs = set()
     assert stack
 
     if path not in stack[-1]: