diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1889,9 +1889,7 @@ revs = _walkrevs(repo, opts) if not revs: return [] - if allfiles and len(revs) > 1: - raise error.Abort(_("multiple revisions not supported with " - "--all-files")) + wanted = set() slowpath = match.anypats() or (not match.always() and opts.get('removed')) fncache = {} @@ -1983,6 +1981,11 @@ it = iter(revs) stopiteration = False + + # the files dictionary stores all the files that have been looked at + # in the allfiles mode + files ={} + for windowsize in increasingwindows(): nrevs = [] for i in xrange(windowsize): @@ -1998,12 +2001,15 @@ if not fns: def fns_generator(): if allfiles: - fiter = iter(ctx) + for f in ctx: + if match(f): + if f not in files: + files[f] = ctx + yield f else: - fiter = ctx.files() - for f in fiter: - if match(f): - yield f + for f in ctx.files(): + if match(f): + yield f fns = fns_generator() prepare(ctx, fns) for rev in nrevs: diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -491,3 +491,12 @@ ] $ cd .. + +test -rMULTIREV with --all-files + + $ cd sng + $ hg rm um + $ hg commit -m "deletes um" + $ hg grep -r "0:2" "unmod" --all-files + um:0:unmod + $ cd ..