Patchwork [4,of,6,for-clowncopter] trydiff: remove dead branch in diffline()

login
register
mail settings
Submitter Martin von Zweigbergk
Date Feb. 3, 2015, 4:58 p.m.
Message ID <fc234a3f6f8ac43ef206.1422982710@martinvonz.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/7631/
State Accepted
Commit 163e25931f659691320cabea455a5285c5e1d212
Headers show

Comments

Martin von Zweigbergk - Feb. 3, 2015, 4:58 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1421450549 28800
#      Fri Jan 16 15:22:29 2015 -0800
# Node ID fc234a3f6f8ac43ef2067aef9136c012bccbe6eb
# Parent  5449a60f29e4b8012fb8754a117876530547d138
trydiff: remove dead branch in diffline()

Since diffline() is never called when 'revs' is empty, it doesn't need
to handle that case.

Patch

diff -r 5449a60f29e4 -r fc234a3f6f8a mercurial/patch.py
--- a/mercurial/patch.py	Fri Jan 16 15:19:57 2015 -0800
+++ b/mercurial/patch.py	Fri Jan 16 15:22:29 2015 -0800
@@ -1755,11 +1755,8 @@ 
 
     def diffline(f, revs):
         if not repo.ui.quiet:
-            if revs:
-                revinfo = ' '.join(["-r %s" % rev for rev in revs])
-                line = 'diff %s %s\n' % (revinfo, f)
-            else:
-                line = 'diff %s\n' % f
+            revinfo = ' '.join(["-r %s" % rev for rev in revs])
+            line = 'diff %s %s\n' % (revinfo, f)
         else:
             line = ''
         return line