diff mercurial/commands.py @ 38430:5d9b765dbe15

tags: unblock log-like template keywords and functions It checks if ctx will be used in template since loading ctx per revision could take extra 10-100msec in total depending on the number of tags.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 08 Jun 2018 22:16:23 +0900
parents 7fbb5d76c555
children 3c07e0b1f6c6
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Jun 08 22:10:22 2018 +0900
+++ b/mercurial/commands.py	Fri Jun 08 22:16:23 2018 +0900
@@ -5438,6 +5438,7 @@
     opts = pycompat.byteskwargs(opts)
     ui.pager('tags')
     fm = ui.formatter('tags', opts)
+    contexthint = fm.contexthint('tag rev node type')
     hexfunc = fm.hexfunc
     tagtype = ""
 
@@ -5450,6 +5451,8 @@
             tagtype = 'local'
 
         fm.startitem()
+        if 'ctx' in contexthint:
+            fm.context(ctx=repo[n])
         fm.write('tag', '%s', t, label=label)
         fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s'
         fm.condwrite(not ui.quiet, 'rev node', fmt,