log: rewrite --follow-first -rREV like --follow for consistency (BC)
authorYuya Nishihara <yuya@tcha.org>
Sun, 10 Dec 2017 18:25:33 +0900
changeset 35646 a177c6aa055a
parent 35645 b6b7855c79aa
child 35647 fc39e2bfcd70
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``.
mercurial/commands.py
tests/test-glog.t
--- a/mercurial/commands.py	Tue Jan 02 17:37:01 2018 +0900
+++ b/mercurial/commands.py	Sun Dec 10 18:25:33 2017 +0900
@@ -3405,7 +3405,11 @@
             _('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']
 
--- a/tests/test-glog.t	Tue Jan 02 17:37:01 2018 +0900
+++ b/tests/test-glog.t	Sun Dec 10 18:25:33 2017 +0900
@@ -2304,22 +2304,9 @@
 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-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