Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 16181:1fd352aa08fc
graphlog: evaluate FILE/-I/-X filesets on the working dir
This subtlety is not documented yet but:
- pats/--include/--exclude filesets are evaluated against the working directory
- --rev filesets are reevaluated against every revisions
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Sun, 26 Feb 2012 17:10:51 +0100 |
parents | 0a73c4bd9f47 |
children | 352053e6cd8e |
line wrap: on
line diff
--- a/mercurial/revset.py Sun Feb 26 16:56:32 2012 +0100 +++ b/mercurial/revset.py Sun Feb 26 17:10:51 2012 +0100 @@ -534,12 +534,16 @@ # # builds a match object from them and filters subset. Allowed # prefixes are 'p:' for regular patterns, 'i:' for include - # patterns and 'x:' for exclude patterns. + # patterns and 'x:' for exclude patterns. Use 'r:' prefix to pass + # a revision identifier, or the empty string to reference the + # working directory, from which the match object is + # initialized. At most one 'r:' argument can be passed. # i18n: "_matchfiles" is a keyword l = getargs(x, 1, -1, _("_matchfiles requires at least one argument")) pats, inc, exc = [], [], [] hasset = False + rev = None for arg in l: s = getstring(arg, _("_matchfiles requires string arguments")) prefix, value = s[:2], s[2:] @@ -549,6 +553,11 @@ inc.append(value) elif prefix == 'x:': exc.append(value) + elif prefix == 'r:': + if rev is not None: + raise error.ParseError(_('_matchfiles expected at most one ' + 'revision')) + rev = value else: raise error.ParseError(_('invalid _matchfiles prefix: %s') % prefix) if not hasset and matchmod.patkind(value) == 'set': @@ -557,9 +566,12 @@ s = [] for r in subset: c = repo[r] - if not m or hasset: + if not m or (hasset and rev is None): + ctx = c + if rev is not None: + ctx = repo[rev or None] m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc, - exclude=exc, ctx=c) + exclude=exc, ctx=ctx) for f in c.files(): if m(f): s.append(r)