Patchwork [2,of,3,STABLE] log: use rev() to build revset of --follow option from numeric revision

login
register
mail settings
Submitter Yuya Nishihara
Date Jan. 25, 2015, 2:09 p.m.
Message ID <38fe74636e4bd991eef6.1422194980@mimosa>
Download mbox | patch
Permalink /patch/7554/
State Accepted
Commit 8a29897d42d2afa1a67f6e4d470284d946a0cf62
Headers show

Comments

Yuya Nishihara - Jan. 25, 2015, 2:09 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1420863240 -32400
#      Sat Jan 10 13:14:00 2015 +0900
# Branch stable
# Node ID 38fe74636e4bd991eef6853b9bb9c514e29aacb1
# Parent  2c01b019a43ddc3ccaed54c2a7869aa88625e13b
log: use rev() to build revset of --follow option from numeric revision

startrev can be -1.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1781,7 +1781,8 @@  def _makelogrevset(repo, pats, opts, rev
                 # manifest entry, so use match.files(), not pats.
                 opts[fpats[followfirst]] = list(match.files())
             else:
-                opts[fnopats[followdescendants][followfirst]] = str(startrev)
+                op = fnopats[followdescendants][followfirst]
+                opts[op] = 'rev(%d)' % startrev
         else:
             opts['_patslog'] = list(pats)
 
diff --git a/tests/test-glog.t b/tests/test-glog.t
--- a/tests/test-glog.t
+++ b/tests/test-glog.t
@@ -1780,7 +1780,9 @@  Test --follow-first
   (group
     (func
       ('symbol', '_firstancestors')
-      ('symbol', '6')))
+      (func
+        ('symbol', 'rev')
+        ('symbol', '6'))))
 
 Cannot compare with log --follow-first FILE as it never worked
 
@@ -2187,7 +2189,9 @@  Test --follow and forward --rev
   (group
     (func
       ('symbol', 'descendants')
-      ('symbol', '6')))
+      (func
+        ('symbol', 'rev')
+        ('symbol', '6'))))
   --- log.nodes	* (glob)
   +++ glog.nodes	* (glob)
   @@ -1,3 +1,3 @@
@@ -2203,7 +2207,9 @@  Test --follow-first and forward --rev
   (group
     (func
       ('symbol', '_firstdescendants')
-      ('symbol', '6')))
+      (func
+        ('symbol', 'rev')
+        ('symbol', '6'))))
   --- log.nodes	* (glob)
   +++ glog.nodes	* (glob)
   @@ -1,3 +1,3 @@
@@ -2219,7 +2225,9 @@  Test --follow and backward --rev
   (group
     (func
       ('symbol', 'ancestors')
-      ('symbol', '6')))
+      (func
+        ('symbol', 'rev')
+        ('symbol', '6'))))
 
 Test --follow-first and backward --rev
 
@@ -2228,7 +2236,9 @@  Test --follow-first and backward --rev
   (group
     (func
       ('symbol', '_firstancestors')
-      ('symbol', '6')))
+      (func
+        ('symbol', 'rev')
+        ('symbol', '6'))))
 
 Test subdir