mq: all_files can be a set, remove dangerous default values
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 13 Mar 2010 00:02:33 +0100
changeset 10661 c4859aad1980
parent 10660 24555e216af6
child 10662 e8e56d8377ab
mq: all_files can be a set, remove dangerous default values
hgext/mq.py
--- a/hgext/mq.py	Fri Mar 12 00:50:41 2010 +0100
+++ b/hgext/mq.py	Sat Mar 13 00:02:33 2010 +0100
@@ -616,7 +616,7 @@
         return (True, files, fuzz)
 
     def apply(self, repo, series, list=False, update_status=True,
-              strict=False, patchdir=None, merge=None, all_files={}):
+              strict=False, patchdir=None, merge=None, all_files=None):
         wlock = lock = tr = None
         try:
             wlock = repo.wlock()
@@ -641,7 +641,7 @@
             self.removeundo(repo)
 
     def _apply(self, repo, series, list=False, update_status=True,
-               strict=False, patchdir=None, merge=None, all_files={}):
+               strict=False, patchdir=None, merge=None, all_files=None):
         '''returns (error, hash)
         error = 1 for unable to read, 2 for patch failed, 3 for patch fuzz'''
         # TODO unify with commands.py
@@ -674,7 +674,8 @@
 
             if ph.haspatch:
                 (patcherr, files, fuzz) = self.patch(repo, pf)
-                all_files.update(files)
+                if all_files is not None:
+                    all_files.update(files)
                 patcherr = not patcherr
             else:
                 self.ui.warn(_("patch %s is empty\n") % patchname)
@@ -1071,7 +1072,7 @@
                 end = self.series.index(patch, start) + 1
 
             s = self.series[start:end]
-            all_files = {}
+            all_files = set()
             try:
                 if mergeq:
                     ret = self.mergepatch(repo, mergeq, s, diffopts)