manifest: make checkforbidden take a list
authorMatt Mackall <mpm@selenic.com>
Fri, 27 Jun 2008 19:27:00 -0500
changeset 6765 be142cb994ff
parent 6764 8db64464d136
child 6766 e81d2bd66908
manifest: make checkforbidden take a list
mercurial/manifest.py
--- a/mercurial/manifest.py	Fri Jun 27 19:25:48 2008 -0500
+++ b/mercurial/manifest.py	Fri Jun 27 19:27:00 2008 -0500
@@ -119,16 +119,16 @@
             return "".join([struct.pack(">lll", d[0], d[1], len(d[2])) + d[2]
                             for d in x ])
 
-        def checkforbidden(f):
-            if '\n' in f or '\r' in f:
-                raise RevlogError(_("'\\n' and '\\r' disallowed in filenames"))
+        def checkforbidden(l):
+            for f in l:
+                if '\n' in f or '\r' in f:
+                    raise RevlogError(_("'\\n' and '\\r' disallowed in filenames"))
 
         # if we're using the listcache, make sure it is valid and
         # parented by the same node we're diffing against
         if not (changed and self.listcache and p1 and self.mapcache[0] == p1):
             files = util.sort(map)
-            for f in files:
-                checkforbidden(f)
+            checkforbidden(files)
 
             # if this is changed to support newlines in filenames,
             # be sure to check the templates/ dir again (especially *-raw.tmpl)
@@ -139,8 +139,7 @@
         else:
             addlist = self.listcache
 
-            for f in changed[0]:
-                checkforbidden(f)
+            checkforbidden(changed[0])
             # combine the changed lists into one list for sorting
             work = [[x, 0] for x in changed[0]]
             work[len(work):] = [[x, 1] for x in changed[1]]