D5620: grep: don't look up copy info unless --follow is given

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Jan 26 01:31:38 EST 2019


martinvonz added a comment.


  In https://phab.mercurial-scm.org/D5620#83924, @yuja wrote:
  
  > > - if fn in skip: +            copy = None +            if follow: +                try: +                    copied = flog.renamed(fnode) +                except error.WdirUnsupported: +                    copied = ctx[fn].renamed() +                copy = copied and copied[0] if copy:
  > > - skip[copy] = True
  > > - continue +                    copies.setdefault(rev, {})[fn] = copy +                    if fn in skip: +                        skip[copy] = True +                        continue files.append(fn)
  >
  > Did you intentionally move `if fn in skip: continue` under `if follow`?
  >  The skip dict has wider scope.
  
  
  Oops, nope, that wasn't on purpose. Thanks for catching that! Feel free to amend the following to the queued commit if it looks good to you:
  
    diff --git a/mercurial/commands.py b/mercurial/commands.py
    --- a/mercurial/commands.py
    +++ b/mercurial/commands.py
    @@ -2955,7 +2955,8 @@ def grep(ui, repo, pattern, *pats, **opt
                         copies.setdefault(rev, {})[fn] = copy
                         if fn in skip:
                             skip[copy] = True
    -                        continue
    +            if fn in skip:
    +                continue
                 files.append(fn)
    
                 if fn not in matches[rev]:

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list