[PATCH 10 of 10] rebase: don't use mutable default argument value

Gregory Szorc gregory.szorc at gmail.com
Mon Dec 26 19:03:16 EST 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1482796851 25200
#      Mon Dec 26 17:00:51 2016 -0700
# Node ID 6e4d3751865e7c359628965b911475816c76a606
# Parent  c5b821235171ec0674de1b005f60ab3591c3ed2c
rebase: don't use mutable default argument value

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -682,12 +682,14 @@ def rebase(ui, repo, **opts):
         rbsrt._finishrebase()
     finally:
         release(lock, wlock)
 
-def _definesets(ui, repo, destf=None, srcf=None, basef=None, revf=[],
+def _definesets(ui, repo, destf=None, srcf=None, basef=None, revf=None,
                 destspace=None):
     """use revisions argument to define destination and rebase set
     """
+    revf = revf or []
+
     # destspace is here to work around issues with `hg pull --rebase` see
     # issue5214 for details
     if srcf and basef:
         raise error.Abort(_('cannot specify both a source and a base'))
diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -29,11 +29,8 @@ New errors are not allowed. Warnings are
    mutable default argument value (list)
   hgext/convert/common.py:58:
    >                  extra=None, sortkey=None, saverev=True, phase=phases.draft,
    attribute default argument value may be mutable
-  hgext/rebase.py:686:
-   > def _definesets(ui, repo, destf=None, srcf=None, basef=None, revf=[],
-   mutable default argument value (list)
   Skipping i18n/polib.py it has no-che?k-code (glob)
   mercurial/changegroup.py:260:
    >               targetphase=phases.draft, expectedtotal=None):
    attribute default argument value may be mutable


More information about the Mercurial-devel mailing list