Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 45491:8ceb5b4b2728
grep: make -frREV follow history from the specified revision (BC)
This is close to what "log -frREV" will do, and is backported from
8b4b9ee6001a, "log: make -fr show complete history from the given revs"
except for the "del opts['follow']" bit.
I'm planning to rewrite cmdutil.walkchangerevs() to share the core logic
with logcmdutil, and this is the first step towards that. There are still
many broken tests, but the fundamental behavior should be fixed by this
patch.
.. bc::
`hg grep -fr REV` now follows history from the specified `REV`, works in
the same way as `hg log -fr REV`. The previous behavior was to limit
the search space to `REV` while following the history.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 10 Sep 2020 14:23:12 +0900 |
parents | 3dc848d5ec77 |
children | 10284ce3d5ed |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Fri Sep 11 18:33:41 2020 +0900 +++ b/mercurial/cmdutil.py Thu Sep 10 14:23:12 2020 +0900 @@ -2254,8 +2254,12 @@ # Default --rev value depends on --follow but --follow behavior # depends on revisions resolved from --rev... follow = opts.get(b'follow') or opts.get(b'follow_first') - if opts.get(b'rev'): - revs = scmutil.revrange(repo, opts[b'rev']) + revspec = opts.get(b'rev') + if follow and revspec: + revs = scmutil.revrange(repo, revspec) + revs = repo.revs(b'reverse(::%ld)', revs) + elif revspec: + revs = scmutil.revrange(repo, revspec) elif follow and repo.dirstate.p1() == nullid: revs = smartset.baseset() elif follow: