histedit: drop fallback to empty string from rendertemplate()
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 22 Oct 2020 23:35:04 -0700
changeset 45814 1f9736eb0e65
parent 45813 5d65e04b6a80
child 45815 1703a7f9d5b8
histedit: drop fallback to empty string from rendertemplate() AFAICT, `cmdutil.rendertemplate()` always returns bytes (never e.g. `None`), so we don't need to fall back to empty (byte-)string. The fallback has been there since the code was added in 11c076786d56 (histedit: add templating support to histedit's rule file generation, 2019-01-29). Differential Revision: https://phab.mercurial-scm.org/D9244
hgext/histedit.py
--- a/hgext/histedit.py	Tue Oct 20 17:32:45 2020 +0200
+++ b/hgext/histedit.py	Thu Oct 22 23:35:04 2020 -0700
@@ -525,11 +525,8 @@
         """
         ctx = self.repo[self.node]
         ui = self.repo.ui
-        summary = (
-            cmdutil.rendertemplate(
-                ctx, ui.config(b'histedit', b'summary-template')
-            )
-            or b''
+        summary = cmdutil.rendertemplate(
+            ctx, ui.config(b'histedit', b'summary-template')
         )
         summary = summary.splitlines()[0]
         line = b'%s %s %s' % (self.verb, ctx, summary)
@@ -1152,11 +1149,8 @@
 
     @util.propertycache
     def desc(self):
-        summary = (
-            cmdutil.rendertemplate(
-                self.ctx, self.ui.config(b'histedit', b'summary-template')
-            )
-            or b''
+        summary = cmdutil.rendertemplate(
+            self.ctx, self.ui.config(b'histedit', b'summary-template')
         )
         if summary:
             return summary