[Request] [+ ] D12011: filemerge: remove unnecessary check for empty string

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jan 21 23:34:57 UTC 2022


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Looking at the statement just before, the string is clearly never
  empty (or otherwise falsy).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -837,9 +837,7 @@
 
     label = (b'%s:' % label).ljust(pad + 1)
     mark = b'%s %s' % (label, templateresult)
-
-    if mark:
-        mark = mark.splitlines()[0]  # split for safety
+    mark = mark.splitlines()[0]  # split for safety
 
     # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ')
     return stringutil.ellipsis(mark, 80 - 8)



To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220121/c8b7221f/attachment.html>


More information about the Mercurial-patches mailing list