Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
45490:3dc848d5ec77 | 45491:8ceb5b4b2728 |
---|---|
2252 | 2252 |
2253 def _walkrevs(repo, opts): | 2253 def _walkrevs(repo, opts): |
2254 # Default --rev value depends on --follow but --follow behavior | 2254 # Default --rev value depends on --follow but --follow behavior |
2255 # depends on revisions resolved from --rev... | 2255 # depends on revisions resolved from --rev... |
2256 follow = opts.get(b'follow') or opts.get(b'follow_first') | 2256 follow = opts.get(b'follow') or opts.get(b'follow_first') |
2257 if opts.get(b'rev'): | 2257 revspec = opts.get(b'rev') |
2258 revs = scmutil.revrange(repo, opts[b'rev']) | 2258 if follow and revspec: |
2259 revs = scmutil.revrange(repo, revspec) | |
2260 revs = repo.revs(b'reverse(::%ld)', revs) | |
2261 elif revspec: | |
2262 revs = scmutil.revrange(repo, revspec) | |
2259 elif follow and repo.dirstate.p1() == nullid: | 2263 elif follow and repo.dirstate.p1() == nullid: |
2260 revs = smartset.baseset() | 2264 revs = smartset.baseset() |
2261 elif follow: | 2265 elif follow: |
2262 revs = repo.revs(b'reverse(:.)') | 2266 revs = repo.revs(b'reverse(:.)') |
2263 else: | 2267 else: |