[PATCH 1 of 2] revset: add "subrepo" revset symbol

Matt Mackall mpm at selenic.com
Tue Mar 27 14:49:55 CDT 2012


On Thu, 2012-03-22 at 23:17 +0100, Angel Ezquerra wrote:
> # HG changeset patch
> # User Angel Ezquerra <angel.ezquerra at gmail.com>
> # Date 1332447135 -3600
> # Node ID 698737a841b9d4f28eb6849a836ab90d70fff174
> # Parent  54df21ce2c2cc39481697a42f06b5f873f1cc075
> revset: add "subrepo" revset symbol
> 
> This new revset symbol finds those revisions in which any subrepo whose path
> matches a given glob pattern were modified (e.g. "subrepo(my*repo)").
> 
> If no argument is passed, find those revisions in which any subrepo was
> modified.

Seems ok.

> +def subrepo(repo, subset, x):
> +    """``subrepo([path])``
> +    Find revisions where the selected subrepo has been modified.
> +    With no argument, find revisions where any subrepo has been modified.
> +    """
> +    # i18n: "subrepo" is a keyword
> +    if x:
> +        pat = encoding.lower(
> +            getstring(x, _("subrepo requires a string or no arguments")))

Case mangling = bad.

> +        def matchpat(pat, subs):
> +            for sub in subs:
> +                if fnmatch.fnmatch(sub, pat):
> +                    return True
> +            return False

That's definitely not the pattern for filename matching in Mercurial. We
use our own much more powerful match module:

http://www.selenic.com/hg/file/9952ac7e0968/mercurial/revset.py#l298

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list