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

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Mar 25 05:38:38 UTC 2022


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

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):



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


More information about the Mercurial-devel mailing list