Fix bug with empty inc and exc
authormpm@selenic.com
Sun, 14 Aug 2005 12:23:36 -0800
changeset 897 fe30f5434b51
parent 896 01215ad04283
child 898 3616c0d7ab88
Fix bug with empty inc and exc This fixes an exception that showed up when importing patches
mercurial/util.py
--- 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