comparison mercurial/commands.py @ 38984:f3f109971359

grep: add MULTIREV support to --allfiles flag This patch facilitates passing multiple revisions with all-files flag. It's assumed that if you are passing multiple revisions to --allfiles, you want hits from all of them. Differential Revision: https://phab.mercurial-scm.org/D3976
author Sangeet Kumar Mishra <mail2sangeetmishra@gmail.com>
date Wed, 25 Jul 2018 12:50:31 +0530
parents 49b51f41fb46
children 2525c4943c09
comparison
equal deleted inserted replaced
38983:0dce1297dd01 38984:f3f109971359
2531 2531
2532 Returns 0 if a match is found, 1 otherwise. 2532 Returns 0 if a match is found, 1 otherwise.
2533 """ 2533 """
2534 opts = pycompat.byteskwargs(opts) 2534 opts = pycompat.byteskwargs(opts)
2535 diff = opts.get('all') or opts.get('diff') 2535 diff = opts.get('all') or opts.get('diff')
2536 all_files = opts.get('all_files')
2536 if diff and opts.get('all_files'): 2537 if diff and opts.get('all_files'):
2537 raise error.Abort(_('--diff and --all-files are mutually exclusive')) 2538 raise error.Abort(_('--diff and --all-files are mutually exclusive'))
2538 # TODO: remove "not opts.get('rev')" if --all-files -rMULTIREV gets working 2539 # TODO: remove "not opts.get('rev')" if --all-files -rMULTIREV gets working
2539 if opts.get('all_files') is None and not opts.get('rev') and not diff: 2540 if opts.get('all_files') is None and not opts.get('rev') and not diff:
2540 # experimental config: commands.grep.all-files 2541 # experimental config: commands.grep.all-files
2755 continue 2756 continue
2756 pstates = matches.get(parent, {}).get(copy or fn, []) 2757 pstates = matches.get(parent, {}).get(copy or fn, [])
2757 if pstates or states: 2758 if pstates or states:
2758 r = display(fm, fn, ctx, pstates, states) 2759 r = display(fm, fn, ctx, pstates, states)
2759 found = found or r 2760 found = found or r
2760 if r and not diff: 2761 if r and not diff and not all_files:
2761 skip[fn] = True 2762 skip[fn] = True
2762 if copy: 2763 if copy:
2763 skip[copy] = True 2764 skip[copy] = True
2764 del revfiles[rev] 2765 del revfiles[rev]
2765 # We will keep the matches dict for the duration of the window 2766 # We will keep the matches dict for the duration of the window