templatekw: use ctx.rev() instead of casting context to int
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 24 Feb 2018 10:48:24 -0800
changeset 36431 d65642840c6f
parent 36430 7b86aa31b004
child 36432 ef6ae3f64c23
templatekw: use ctx.rev() instead of casting context to int basectx has __int__ implemented. Per mailing list discussion with Yuya, we don't like having this implemented because it is too much magic and in some cases rev() will return None, which isn't an int. So convert a `'%d' % ctx` to ctx.rev() instead. Differential Revision: https://phab.mercurial-scm.org/D2423
mercurial/templatekw.py
--- a/mercurial/templatekw.py	Sat Feb 24 16:18:40 2018 +0530
+++ b/mercurial/templatekw.py	Sat Feb 24 10:48:24 2018 -0800
@@ -400,7 +400,7 @@
     """List of strings. The children of the changeset."""
     args = pycompat.byteskwargs(args)
     ctx = args['ctx']
-    childrevs = ['%d:%s' % (cctx, cctx) for cctx in ctx.children()]
+    childrevs = ['%d:%s' % (cctx.rev(), cctx) for cctx in ctx.children()]
     return showlist('children', childrevs, args, element='child')
 
 # Deprecated, but kept alive for help generation a purpose.