[PATCH] cmdutil: fall back to filename if glob expand has errors

Steve Borho steve at borho.org
Sun Jul 12 00:50:04 CDT 2009


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1247377603 18000
# Node ID 7cfc9efc3d4e8591be5efb375016ab3418f5e96d
# Parent  b81baf9e4dd6fe5e475fb431977e838761632ef2
cmdutil: fall back to filename if glob expand has errors

On Windows, Mercurial tries to glob expand provided filenames as a
convenience to the user. Unfortunately, there are valid filenames
which are not valid glob patterns.  In those cases, we should fallback
to the original provided filename.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -242,7 +242,10 @@
     for p in pats:
         kind, name = _match._patsplit(p, None)
         if kind is None:
-            globbed = glob.glob(name)
+            try:
+                globbed = glob.glob(name)
+            except re.error:
+                globbed = [name]
             if globbed:
                 ret.extend(globbed)
                 continue


More information about the Mercurial-devel mailing list