Patchwork [1,of,4] templatekw: extract internal "{rev}:{node|formatnode}" template to constant

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 2, 2018, 1:18 p.m.
Message ID <276558285cd47fc388ae.1541164716@mimosa>
Download mbox | patch
Permalink /patch/36335/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 2, 2018, 1:18 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1540556900 -32400
#      Fri Oct 26 21:28:20 2018 +0900
# Node ID 276558285cd47fc388aed7861eaf7237c6d184e3
# Parent  c2a0bc6412dbbcbba20517e250b0fcd2fc79b0e7
templatekw: extract internal "{rev}:{node|formatnode}" template to constant

This will be used later.

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -153,10 +153,13 @@  def getlogcolumns():
     return dict(zip([s.split(':', 1)[0] for s in columns.splitlines()],
                     i18n._(columns).splitlines(True)))
 
+# basic internal templates
+_changeidtmpl = '{rev}:{node|formatnode}'
+
 # default templates internally used for rendering of lists
 defaulttempl = {
-    'parent': '{rev}:{node|formatnode} ',
-    'manifest': '{rev}:{node|formatnode}',
+    'parent': _changeidtmpl + ' ',
+    'manifest': _changeidtmpl,
     'file_copy': '{name} ({source})',
     'envvar': '{key}={value}',
     'extra': '{key}={value|stringescape}'