yuja added a comment.

  Perhaps we can start with adding an experimental option to grep files
  including unchanged ones?
  
  IIUC, the new default behavior is something like `hg grep -r "wdir()" 
--all-files`,
  which is basically `s/ctx.files()/ctx/`.
  (needless to say `--all-files` is a bad name, and the following patch is just 
a hack.)
  
    diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
    --- a/mercurial/cmdutil.py
    +++ b/mercurial/cmdutil.py
    @@ -1835,7 +1835,7 @@ def walkchangerevs(repo, match, opts, pr
         if not revs:
             return []
         wanted = set()
    -    slowpath = match.anypats() or (not match.always() and 
opts.get('removed'))
    +    slowpath = True
         fncache = {}
         change = repo.changectx
     
    @@ -1889,7 +1889,7 @@ def walkchangerevs(repo, match, opts, pr
                     else:
                         self.revs.discard(value)
                         ctx = change(value)
    -                    matches = [f for f in ctx.files() if match(f)]
    +                    matches = [f for f in ctx if match(f)]
                         if matches:
                             fncache[value] = matches
                             self.set.add(value)
    @@ -1939,7 +1939,7 @@ def walkchangerevs(repo, match, opts, pr
                     ctx = change(rev)
                     if not fns:
                         def fns_generator():
    -                        for f in ctx.files():
    +                        for f in ctx:
                                 if match(f):
                                     yield f
                         fns = fns_generator()

REPOSITORY
  rHG Mercurial

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

To: sangeet259, #hg-reviewers
Cc: yuja, pulkit, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to