cmdutil.matchpats: allow include/exclude to be optional.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Sun, 13 Aug 2006 17:03:33 -0700
changeset 2885 bd29a3067b97
parent 2884 fcdcf0c19998
child 2886 bee4b7abcb01
child 2900 26c37ebda1bb
cmdutil.matchpats: allow include/exclude to be optional.
mercurial/cmdutil.py
--- a/mercurial/cmdutil.py	Sun Aug 13 17:03:03 2006 -0700
+++ b/mercurial/cmdutil.py	Sun Aug 13 17:03:33 2006 -0700
@@ -71,8 +71,10 @@
 def matchpats(repo, pats=[], opts={}, head=''):
     cwd = repo.getcwd()
     if not pats and cwd:
-        opts['include'] = [os.path.join(cwd, i) for i in opts['include']]
-        opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']]
+        opts['include'] = [os.path.join(cwd, i)
+                           for i in opts.get('include', [])]
+        opts['exclude'] = [os.path.join(cwd, x)
+                           for x in opts.get('exclude', [])]
         cwd = ''
     return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'),
                            opts.get('exclude'), head)