changeset 44567:ad5a10f49dfa

chistedit: support histedit.summary-template in curses histedit plan Differential Revision: https://phab.mercurial-scm.org/D8296
author Kyle Lippincott <spectral@google.com>
date Tue, 17 Mar 2020 12:59:31 -0700
parents 77d48738b8e0
children 3aab524a8480
files hgext/histedit.py
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Mon Jul 22 09:58:23 2019 -0700
+++ b/hgext/histedit.py	Tue Mar 17 12:59:31 2020 -0700
@@ -1113,7 +1113,8 @@
 
 
 class histeditrule(object):
-    def __init__(self, ctx, pos, action=b'pick'):
+    def __init__(self, ui, ctx, pos, action=b'pick'):
+        self.ui = ui
         self.ctx = ctx
         self.action = action
         self.origpos = pos
@@ -1153,6 +1154,14 @@
 
     @property
     def desc(self):
+        summary = (
+            cmdutil.rendertemplate(
+                self.ctx, self.ui.config(b'histedit', b'summary-template')
+            )
+            or b''
+        )
+        if summary:
+            return summary
         # This is split off from the prefix property so that we can
         # separately make the description for 'roll' red (since it
         # will get discarded).
@@ -1700,7 +1709,7 @@
 
         ctxs = []
         for i, r in enumerate(revs):
-            ctxs.append(histeditrule(repo[r], i))
+            ctxs.append(histeditrule(ui, repo[r], i))
         # Curses requires setting the locale or it will default to the C
         # locale. This sets the locale to the user's default system
         # locale.