D3976: grep: add MULTIREV support to --all-files flag

Yuya Nishihara yuya at tcha.org
Sat Aug 4 03:22:33 EDT 2018


>   >   I also expect hg grep --all-files -r0+1 foo will show matches from both rev 0 and 1.
>   
>   Suppose there are ten hits in 0 and the same 10 hits in 1, do you mean we print out all the 20 results, What purpose that would serve?

Yes. I think that's the least surprising behavior for --all-files, which is
the option to ignore file status. Say a file is modified at both rev 0 and 1,
which revisions should be grepped?

 a. only rev 0
 b. rev 0 and rev 1 (because a file is changed at rev 1)
 c. rev 0 and rev 1 (no matter if a file is changed or not)
 d. --all-files for rev 0, and --diff for rev 1

(a) is the awkward behavior of the current "hg grep" which we're trying to
fix. (b) might sound sensible, but why are unchanged lines in rev 1 displayed
again? (c) shows redundant matches, but is consistent. (d) seems a bit tricky,
but will be useful.

So my proposal was (c). If we take (d), which I think is also good, we'll
need to find more appropriate option name than --all-files.


More information about the Mercurial-devel mailing list