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

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Fri May 25 09:14:07 EDT 2018


yuja added a comment.


  >   So I was working on it, but the way I tried to correct "wdir()" is by handling it as a special case, so introducing an "if" block again similar to this.
  >   But you were asking to eliminate the if/else block altogether, I wonder if there is way ?
  
  IIRC, my point was to avoid adding *big* if/else branch which will be likely
  to introduce untested code paths.
  
  I don't think there would be a way to go without if/else or try/except as
  long as we use the low-level filelog API for performance reasons. Perhaps,
  we'll have to catch WdirUnsupported error to fall back to the filectx API.
  
    try:
        flog.read(fnode)
    except error.WdirUnsupported:
        ctx[fn].data()

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