D2938: grep: make grep search on working directory by default
Yuya Nishihara
yuya at tcha.org
Tue Jun 12 10:41:13 EDT 2018
> @yuja I am adding an --unmodified flag to change to change the mode to grep on the unmodified files as well.
> What I am trying to do is ::
>
> def fns_generator():
> if --unmodified:
> for f in ctx:
> for f in ctx:
> if match(f):
> yield f
> else :
> for f in ctx.files():
> for f in ctx:
> if match(f):
> yield f
Nit: `if` can be narrowed to `ctx`/`ctx.files()`.
```
if --unmodified:
fiter = iter(ctx)
else:
fiter = ctx.files()
```
> Currently, this would work for a single revision, so I am modifying the `prep` function in grep.
> Shall I continue and send the patch ?
Seems fine. It should be generally encouraged to send patches than discussing
for long without a working code.
> but @yuja has asked me to break this patch into three patches. So I guess
> this is not going to be merged anyway.
To be clear, I suggested to split patches because the original code seemed
to add a single knob to switch two more features at once.
More information about the Mercurial-devel
mailing list