Patchwork D8296: chistedit: support histedit.summary-template in curses histedit plan

login
register
mail settings
Submitter phabricator
Date March 17, 2020, 9:28 p.m.
Message ID <d0ada42e4d81d6d735c17b86acd99543@localhost.localdomain>
Download mbox | patch
Permalink /patch/45811/
State Not Applicable
Headers show

Comments

phabricator - March 17, 2020, 9:28 p.m.
Closed by commit rHGad5a10f49dfa: chistedit: support histedit.summary-template in curses histedit plan (authored by spectral).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8296?vs=20811&id=20815

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8296/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8296

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS




To: spectral, durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -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.