##// END OF EJS Templates
grep: adds allfiles mode...
Sangeet Kumar Mishra -
r38361:b8f45fc2 default
parent child Browse files
Show More
@@ -1881,10 +1881,13 b' def walkchangerevs(repo, match, opts, pr'
1881 1881 yielding each context, the iterator will first call the prepare
1882 1882 function on each context in the window in forward order.'''
1883 1883
1884 allfiles = opts.get('allfiles')
1884 1885 follow = opts.get('follow') or opts.get('follow_first')
1885 1886 revs = _walkrevs(repo, opts)
1886 1887 if not revs:
1887 1888 return []
1889 if allfiles and len(revs) > 1:
1890 raise error.Abort(_("multiple revisions not supported with --allfiles"))
1888 1891 wanted = set()
1889 1892 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
1890 1893 fncache = {}
@@ -1990,7 +1993,11 b' def walkchangerevs(repo, match, opts, pr'
1990 1993 ctx = change(rev)
1991 1994 if not fns:
1992 1995 def fns_generator():
1993 for f in ctx.files():
1996 if allfiles:
1997 fiter = iter(ctx)
1998 else:
1999 fiter = ctx.files()
2000 for f in fiter:
1994 2001 if match(f):
1995 2002 yield f
1996 2003 fns = fns_generator()
@@ -2403,6 +2403,8 b' def _stopgraft(ui, repo, graftstate):'
2403 2403 ('n', 'line-number', None, _('print matching line numbers')),
2404 2404 ('r', 'rev', [],
2405 2405 _('only search files changed within revision range'), _('REV')),
2406 ('', 'allfiles', False,
2407 _('include all files in the changeset while grepping (EXPERIMENTAL)')),
2406 2408 ('u', 'user', None, _('list the author (long with -v)')),
2407 2409 ('d', 'date', None, _('list the date (short with -q)')),
2408 2410 ] + formatteropts + walkopts,
@@ -313,7 +313,7 b' Show all commands + options'
313 313 debugwireproto: localssh, peer, noreadstderr, nologhandshake, ssh, remotecmd, insecure
314 314 files: rev, print0, include, exclude, template, subrepos
315 315 graft: rev, continue, stop, edit, log, force, currentdate, currentuser, date, user, tool, dry-run
316 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude
316 grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, allfiles, user, date, template, include, exclude
317 317 heads: rev, topo, active, closed, style, template
318 318 help: extension, command, keyword, system
319 319 identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure, template
@@ -372,6 +372,23 b' revisions printed, just their order.'
372 372
373 373 $ cd ..
374 374
375 Test for showing working of allfiles flag
376
377 $ hg init sng
378 $ cd sng
379 $ echo "unmod" >> um
380 $ hg ci -A -m "adds unmod to um"
381 adding um
382 $ echo "something else" >> new
383 $ hg ci -A -m "second commit"
384 adding new
385 $ hg grep -r "." "unmod"
386 [1]
387 $ hg grep -r "." "unmod" --allfiles
388 um:1:unmod
389
390 $ cd ..
391
375 392 Fix_Wdir(): test that passing wdir() t -r flag does greps on the
376 393 files modified in the working directory
377 394
General Comments 0
You need to be logged in to leave comments. Login now