changeset 26329:d9537ce64f3a

addremove: remove a mutable default argument Mutable default arguments are know to the state of California to cause bugs.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 24 Sep 2015 01:04:10 -0700
parents 188c1e9506f5
children ec4f3755d997
files mercurial/scmutil.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Thu Sep 24 01:00:43 2015 -0700
+++ b/mercurial/scmutil.py	Thu Sep 24 01:04:10 2015 -0700
@@ -791,7 +791,9 @@
     '''Return a matcher that will efficiently match exactly these files.'''
     return matchmod.exact(repo.root, repo.getcwd(), files, badfn=badfn)
 
-def addremove(repo, matcher, prefix, opts={}, dry_run=None, similarity=None):
+def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None):
+    if opts is None:
+        opts = {}
     m = matcher
     if dry_run is None:
         dry_run = opts.get('dry_run')