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

Steve Borho steve at borho.org
Sun Jul 12 11:00:49 CDT 2009


On Sun, Jul 12, 2009 at 12:50 AM, Steve Borho<steve at borho.org> wrote:
> # 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

This patch is intended to fix the traceback encountered with hg log in
this bug report:

http://bitbucket.org/tortoisehg/stable/issue/363/

--
Steve Borho



More information about the Mercurial-devel mailing list