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

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Sun Mar 25 04:36:23 EDT 2018


yuja added a comment.


  In https://phab.mercurial-scm.org/D2938#47514, @sangeet259 wrote:
  
  > @yuja Can you please clarify this a bit more?
  >
  > > Perhaps we can start with adding an experimental option to grep files
  > >  including unchanged ones?"
  
  
  This patch appears to do 3 separate things by adding a big "if" branch.
  
  - fix `grep -r 'wdir()'`
  - add mode to include unmodified files
  - change the default
  
  It's probably better to write one (or more) patches for each change, in a way
  not duplicating code for each combination of possible options.

INLINE COMMENTS

> sangeet259 wrote in commands.py:2474
> Sure, pushing the first approach now.
> But, I think the second approach fits the "Easier to ask for forgiveness than permission" philosophy of python.
> 
> Currently the filenode of workingctx returns this: `return self._fileinfo(path)[0]` . Shall I change that to returning wdirid?
> 
> Also can you please highlight the slowpath part? Any reference or links to mailing lists, where I can learn more about it.

> Shall I change that to returning wdirid?

That isn't easy to answer because `wctx.filenode()` can return
another pseudo
hash (e.g. 000000000000000added) if `wctx._manifest` is preloaded.

> highlight the slowpath part

It's quite old, so I have no concrete idea. But maybe reusing filelog objects is the key.

> sangeet259 wrote in commands.py:2475
> Done. Any reason why that is better?

Extensions may override it to provide a faster implementation.

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list