# HG changeset patch
# User Yuya Nishihara <y...@tcha.org>
# Date 1512897933 -32400
#      Sun Dec 10 18:25:33 2017 +0900
# Node ID 7c2c82f67697a0957afaa9b4f450d7b03eaa9536
# Parent  438dde28f8693b822898903325d2567c5e618c4b
log: rewrite --follow-first -rREV like --follow for consistency (BC)

This helps fixing the "--follow -rREV PATH" issue.

.. bc::

   ``log --follow-first -rREV``, which is deprecated, now follows the first
   parent of merge revisions from the specified ``REV`` just like
   ``log --follow -rREV``.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3405,7 +3405,11 @@ def log(ui, repo, *pats, **opts):
             _('FILE arguments are not compatible with --line-range option')
         )
 
-    if opts.get('follow') and opts.get('rev'):
+    if opts.get('follow_first') and opts.get('rev'):
+        opts['rev'] = [revsetlang.formatspec('reverse(_firstancestors(%lr))',
+                                             opts.get('rev'))]
+        del opts['follow_first']
+    elif opts.get('follow') and opts.get('rev'):
         opts['rev'] = [revsetlang.formatspec('reverse(::%lr)', 
opts.get('rev'))]
         del opts['follow']
 
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -2304,22 +2304,9 @@ changessincelatesttag with no prior tag
 Test --follow-first and forward --rev
 
   $ testlog --follow-first -r6 -r8 -r5 -r7 -r4
-  ['6', '8', '5', '7', '4']
-  (func
-    (symbol '_firstdescendants')
-    (func
-      (symbol 'rev')
-      (symbol '6')))
-  <filteredset
-    <baseset- [4, 5, 6, 7, 8]>,
-    <generatorsetasc+>>
-  --- log.nodes        * (glob)
-  +++ glog.nodes       * (glob)
-  @@ -1,3 +1,3 @@
-  -nodetag 6
-   nodetag 8
-   nodetag 7
-  +nodetag 6
+  ['reverse(_firstancestors((((6) or (8)) or ((5) or ((7) or (4))))))']
+  []
+  <generatorsetdesc->
 
 Test --follow and backward --rev
 
@@ -2331,15 +2318,9 @@ Test --follow and backward --rev
 Test --follow-first and backward --rev
 
   $ testlog --follow-first -r6 -r5 -r7 -r8 -r4
-  ['6', '5', '7', '8', '4']
-  (func
-    (symbol '_firstancestors')
-    (func
-      (symbol 'rev')
-      (symbol '6')))
-  <filteredset
-    <baseset- [4, 5, 6, 7, 8]>,
-    <generatorsetdesc+>>
+  ['reverse(_firstancestors((((6) or (5)) or ((7) or ((8) or (4))))))']
+  []
+  <generatorsetdesc->
 
 Test --follow with --rev of graphlog extension
 
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to