diff mercurial/util.py @ 897:fe30f5434b51

Fix bug with empty inc and exc This fixes an exception that showed up when importing patches
author mpm@selenic.com
date Sun, 14 Aug 2005 12:23:36 -0800
parents 01215ad04283
children 302f83b85054
line wrap: on
line diff
--- a/mercurial/util.py	Sat Aug 13 19:43:42 2005 -0800
+++ b/mercurial/util.py	Sun Aug 14 12:23:36 2005 -0800
@@ -92,7 +92,7 @@
         return ''
     else:
         raise Abort('%s not under repository root' % myname)
-    
+
 def matcher(repo, cwd, names, inc, exc, head = ''):
     def patkind(name):
         for prefix in 're:', 'glob:', 'path:', 'relpath:':
@@ -141,11 +141,15 @@
         elif kind == 'relpath':
             files.append((kind, name))
             roots.append(name)
-        
+
     patmatch = matchfn(pats, '$') or always
     filematch = matchfn(files, '(?:/|$)') or always
-    incmatch = matchfn(map(patkind, inc), '(?:/|$)') or always
-    excmatch = matchfn(map(patkind, exc), '(?:/|$)') or (lambda fn: False)
+    incmatch = always
+    if inc:
+        incmatch = matchfn(map(patkind, inc), '(?:/|$)')
+    excmatch = lambda fn: False
+    if exc:
+        excmatch = matchfn(map(patkind, exc), '(?:/|$)')
 
     return roots, lambda fn: (incmatch(fn) and not excmatch(fn) and
                               (fn.endswith('/') or