fix patch.patch.filterfiles.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Sun, 13 Aug 2006 15:24:30 -0700
changeset 2880 eab07a7b7491
parent 2879 51b8d1ca7820
child 2881 cf98cd70d2c4
fix patch.patch.filterfiles. now test-diff-subdir passes.
mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -277,16 +277,15 @@ def diff(repo, node1=None, node2=None, f
     modified, added, removed, deleted, unknown = changes
     if files:
         def filterfiles(filters):
-            l = [x for x in files if x in filters]
+            l = [x for x in filters if x in files]
 
-            for t in filters:
-                if t and t[-1] != "/":
+            for t in files:
+                if not t.endswith("/"):
                     t += "/"
-                l += [x for x in files if x.startswith(t)]
+                l += [x for x in filters if x.startswith(t)]
             return l
 
-        modified, added, removed = map(lambda x: filterfiles(x),
-                                       (modified, added, removed))
+        modified, added, removed = map(filterfiles, (modified, added, removed))
 
     if not modified and not added and not removed:
         return