mercurial/cmdutil.py
changeset 35684 1c929b4942a3
parent 35683 ea3320015d54
child 35685 659dfbd852e2
--- 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