D2938: grep: make grep search on working directory by default

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Tue Jun 12 10:42:28 EDT 2018


yuja added a comment.


  >   @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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2938

To: sangeet259, #hg-reviewers
Cc: martinvonz, av6, yuja, pulkit, mercurial-devel


More information about the Mercurial-devel mailing list