Patchwork D9244: histedit: drop fallback to empty string from rendertemplate()

login
register
mail settings
Submitter phabricator
Date Oct. 23, 2020, 6:43 a.m.
Message ID <differential-rev-PHID-DREV-l2hoav3n5msp76sryixl-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47512/
State Superseded
Headers show

Comments

phabricator - Oct. 23, 2020, 6:43 a.m.
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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 <https://phab.mercurial-scm.org/rHG11c076786d56a0e43a508548b761a6242e33aa6f> (histedit: add templating support to histedit's rule file
  generation, 2019-01-29).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS




To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

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