Patchwork D12406: histedit: remove an unnecessary default value of `b''` for commit message

login
register
mail settings
Submitter phabricator
Date March 25, 2022, 5:38 a.m.
Message ID <differential-rev-PHID-DREV-cbs25jirzdscuwzdjayo-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50753/
State New
Headers show

Comments

phabricator - March 25, 2022, 5:38 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
  I don't think `ctx.description()` is ever anything falsy other than
  `b''`. I think the comment added in 4c4232e51167 <https://phab.mercurial-scm.org/rHG4c4232e511677f06f684bdbf532bdc9e4adf5c9a> (histedit: extract
  common summary code into method, 2016-05-27) is mistaken (I don't see
  any code following that pattern before the function was added).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -2319,10 +2319,7 @@ 
 
 
 def _getsummary(ctx):
-    # a common pattern is to extract the summary but default to the empty
-    # string
-    summary = ctx.description() or b''
-    return stringutil.firstline(summary)
+    return stringutil.firstline(ctx.description())
 
 
 def bootstrapcontinue(ui, state, opts):