Patchwork D12011: filemerge: remove unnecessary check for empty string

login
register
mail settings
Submitter phabricator
Date Jan. 21, 2022, 11:34 p.m.
Message ID <differential-rev-PHID-DREV-32b7r4k7b76b7v2mjqe7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50337/
State New
Headers show

Comments

phabricator - Jan. 21, 2022, 11:34 p.m.
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




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

Patch

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)