Mercurial > hg-stable
changeset 16411:4c2edcd84175
graphlog: correctly handle calls in subdirectories
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Wed, 11 Apr 2012 11:32:00 +0200 |
parents | 80b3d574881f |
children | 1a10bee86e33 |
files | hgext/graphlog.py mercurial/revset.py tests/test-glog.t tests/test-revset.t |
diffstat | 4 files changed, 43 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/graphlog.py Wed Apr 11 11:29:12 2012 +0200 +++ b/hgext/graphlog.py Wed Apr 11 11:32:00 2012 +0200 @@ -340,7 +340,7 @@ # "a" and "b" while "file(a) and not file(b)" does # not. Besides, filesets are evaluated against the working # directory. - matchargs = ['r:'] + matchargs = ['r:', 'd:relpath'] for p in pats: matchargs.append('p:' + p) for p in opts.get('include', []):
--- a/mercurial/revset.py Wed Apr 11 11:29:12 2012 +0200 +++ b/mercurial/revset.py Wed Apr 11 11:32:00 2012 +0200 @@ -559,13 +559,14 @@ # 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. + # initialized. Use 'd:' to set the default matching mode, default + # to 'glob'. At most one 'r:' and 'd:' 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 + rev, default = None, None for arg in l: s = getstring(arg, _("_matchfiles requires string arguments")) prefix, value = s[:2], s[2:] @@ -580,10 +581,17 @@ raise error.ParseError(_('_matchfiles expected at most one ' 'revision')) rev = value + elif prefix == 'd:': + if default is not None: + raise error.ParseError(_('_matchfiles expected at most one ' + 'default mode')) + default = value else: raise error.ParseError(_('invalid _matchfiles prefix: %s') % prefix) if not hasset and matchmod.patkind(value) == 'set': hasset = True + if not default: + default = 'glob' m = None s = [] for r in subset: @@ -593,7 +601,7 @@ if rev is not None: ctx = repo[rev or None] m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc, - exclude=exc, ctx=ctx) + exclude=exc, ctx=ctx, default=default) for f in c.files(): if m(f): s.append(r)
--- a/tests/test-glog.t Wed Apr 11 11:29:12 2012 +0200 +++ b/tests/test-glog.t Wed Apr 11 11:32:00 2012 +0200 @@ -1600,7 +1600,9 @@ ('symbol', '_matchfiles') (list (list - ('string', 'r:') + (list + ('string', 'r:') + ('string', 'd:relpath')) ('string', 'p:a')) ('string', 'p:c')))) @@ -1617,7 +1619,9 @@ (list (list (list - ('string', 'r:') + (list + ('string', 'r:') + ('string', 'd:relpath')) ('string', 'p:a')) ('string', 'p:e')) ('string', 'i:a')) @@ -1791,7 +1795,9 @@ (func ('symbol', '_matchfiles') (list - ('string', 'r:') + (list + ('string', 'r:') + ('string', 'd:relpath')) ('string', 'p:set:copied()')))) $ testlog --include "set:copied()" [] @@ -1799,7 +1805,9 @@ (func ('symbol', '_matchfiles') (list - ('string', 'r:') + (list + ('string', 'r:') + ('string', 'd:relpath')) ('string', 'i:set:copied()')))) $ testlog -r "sort(file('set:copied()'), -rev)" ["sort(file('set:copied()'), -rev)"] @@ -1816,7 +1824,9 @@ (func ('symbol', '_matchfiles') (list - ('string', 'r:') + (list + ('string', 'r:') + ('string', 'd:relpath')) ('string', 'p:a')))) $ testlog --removed --follow a abort: can only follow copies/renames for explicit filenames @@ -2001,3 +2011,18 @@ (func ('symbol', '_firstancestors') ('symbol', '6'))) + +Test subdir + + $ hg up -q 3 + $ cd dir + $ testlog . + [] + (group + (func + ('symbol', '_matchfiles') + (list + (list + ('string', 'r:') + ('string', 'd:relpath')) + ('string', 'p:.'))))