changeset 25740:47469fa8fb01

templatekw: make {rev} return wdirrev instead of None wdirrev/wdirnode identifiers are still experimental, but {node} is mapped to wdirnode. So {rev} should do the same for consistency. I'm not sure if templatekw can import scmutil. If not, we should move intrev() to node module.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 02 Jul 2015 22:18:21 +0900
parents 3dabc9b7494a
children 86fe3c404c1e
files mercurial/templatekw.py tests/test-command-template.t
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templatekw.py	Thu Jul 02 22:03:06 2015 +0900
+++ b/mercurial/templatekw.py	Thu Jul 02 22:18:21 2015 +0900
@@ -6,7 +6,7 @@
 # GNU General Public License version 2 or any later version.
 
 from node import hex
-import patch, util, error
+import patch, scmutil, util, error
 import hbisect
 
 # This helper class allows us to handle both:
@@ -400,7 +400,7 @@
 
 def showrev(repo, ctx, templ, **args):
     """:rev: Integer. The repository-local changeset revision number."""
-    return ctx.rev()
+    return scmutil.intrev(ctx.rev())
 
 def showsubrepos(**args):
     """:subrepos: List of strings. Updated subrepositories in the changeset."""
--- a/tests/test-command-template.t	Thu Jul 02 22:03:06 2015 +0900
+++ b/tests/test-command-template.t	Thu Jul 02 22:18:21 2015 +0900
@@ -51,6 +51,12 @@
   8 t
   7 f
 
+Working-directory revision has special identifiers, though they are still
+experimental:
+
+  $ hg log -r 'wdir()' -T '{rev}:{node}\n'
+  2147483647:ffffffffffffffffffffffffffffffffffffffff
+
 Some keywords are invalid for working-directory revision, but they should
 never cause crash: