# HG changeset patch # User Yuya Nishihara # Date 1512897933 -32400 # Node ID a177c6aa055a86799e9dd9cecc3bbb3531759bcc # Parent b6b7855c79aad1fe37087db5b13c024b0e5aea75 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 -r b6b7855c79aa -r a177c6aa055a mercurial/commands.py --- 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'] diff -r b6b7855c79aa -r a177c6aa055a tests/test-glog.t --- 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'))) - , - > - --- 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))))))'] + [] + 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'))) - , - > + ['reverse(_firstancestors((((6) or (5)) or ((7) or ((8) or (4))))))'] + [] + Test --follow with --rev of graphlog extension