diff mercurial/cmdutil.py @ 35684:1c929b4942a3

log: resolve --follow with -rREV in cmdutil.getlogrevs() This also fixes alias expansion. Before, reverse() could be overridden by user alias. This isn't processed at _logrevs() as we'll need starting revisions to parse file patterns. See the subsequent patches for details.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 10 Dec 2017 17:28:44 +0900
parents ea3320015d54
children 659dfbd852e2
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Sun Dec 10 18:22:06 2017 +0900
+++ b/mercurial/cmdutil.py	Sun Dec 10 17:28:44 2017 +0900
@@ -2518,10 +2518,19 @@
     is a callable taking a revision number and returning a match objects
     filtering the files to be detailed when displaying the revision.
     """
+    follow = opts.get('follow') or opts.get('follow_first')
+    followfirst = opts.get('follow_first')
+    if opts.get('rev'):
+        # TODO: do not mutate opts here
+        opts.pop('follow', None)
+        opts.pop('follow_first', None)
     limit = loglimit(opts)
     revs = _logrevs(repo, opts)
     if not revs:
         return smartset.baseset(), None
+    if opts.get('rev') and follow:
+        revs = dagop.revancestors(repo, revs, followfirst=followfirst)
+        revs.reverse()
     expr, filematcher = _makelogrevset(repo, pats, opts)
     if opts.get('graph') and opts.get('rev'):
         # User-specified revs might be unsorted, but don't sort before