Patchwork [3,of,7] hgk: don't use mutable default argument value

login
register
mail settings
Submitter Pierre-Yves David
Date March 15, 2017, 7:01 a.m.
Message ID <b8d26aeff6a637b61cac.1489561275@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/19348/
State Accepted
Headers show

Comments

Pierre-Yves David - March 15, 2017, 7:01 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1489560505 25200
#      Tue Mar 14 23:48:25 2017 -0700
# Node ID b8d26aeff6a637b61cac05d5b8710bfc1a120f06
# Parent  910e63ee01566dad50ecb1691d2dc845d88a77be
# 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 b8d26aeff6a6
hgk: don't use mutable default argument value

Caught by pylint.

Patch

diff --git a/hgext/hgk.py b/hgext/hgk.py
--- a/hgext/hgk.py
+++ b/hgext/hgk.py
@@ -71,8 +71,10 @@  testedwith = 'ships-with-hg-core'
     inferrepo=True)
 def difftree(ui, repo, node1=None, node2=None, *files, **opts):
     """diff trees from two commits"""
-    def __difftree(repo, node1, node2, files=[]):
+    def __difftree(repo, node1, node2, files=None):
         assert node2 is not None
+        if files is None:
+            files = []
         mmap = repo[node1].manifest()
         mmap2 = repo[node2].manifest()
         m = scmutil.match(repo[node1], files)