[PATCH 6 of 7] localrepo: don't use mutable default argument value

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Mar 15 03:01:18 EDT 2017


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1489560607 25200
#      Tue Mar 14 23:50:07 2017 -0700
# Node ID b24451e8f9a6beee5501e9bedc47af7edc283ea4
# Parent  855f0045de7f94630923be4639f234b28be89e7f
# EXP-Topic check-pylint
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r b24451e8f9a6
localrepo: don't use mutable default argument value

Caught by pylint.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -119,7 +119,9 @@ legacycaps = moderncaps.union(set(['chan
 class localpeer(peer.peerrepository):
     '''peer for a local repo; reflects only the most recent API'''
 
-    def __init__(self, repo, caps=moderncaps):
+    def __init__(self, repo, caps=None):
+        if caps is None:
+            caps = moderncaps.copy()
         peer.peerrepository.__init__(self)
         self._repo = repo.filtered('served')
         self.ui = repo.ui


More information about the Mercurial-devel mailing list