comparison mercurial/scmutil.py @ 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 4b0fc75f9403
comparison
equal deleted inserted replaced
26328:188c1e9506f5 26329:d9537ce64f3a
789 789
790 def matchfiles(repo, files, badfn=None): 790 def matchfiles(repo, files, badfn=None):
791 '''Return a matcher that will efficiently match exactly these files.''' 791 '''Return a matcher that will efficiently match exactly these files.'''
792 return matchmod.exact(repo.root, repo.getcwd(), files, badfn=badfn) 792 return matchmod.exact(repo.root, repo.getcwd(), files, badfn=badfn)
793 793
794 def addremove(repo, matcher, prefix, opts={}, dry_run=None, similarity=None): 794 def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None):
795 if opts is None:
796 opts = {}
795 m = matcher 797 m = matcher
796 if dry_run is None: 798 if dry_run is None:
797 dry_run = opts.get('dry_run') 799 dry_run = opts.get('dry_run')
798 if similarity is None: 800 if similarity is None:
799 similarity = float(opts.get('similarity') or 0) 801 similarity = float(opts.get('similarity') or 0)