Patchwork [4,of,5] revpair: drop useless conditional

login
register
mail settings
Submitter Pierre-Yves David
Date March 21, 2014, 6:28 p.m.
Message ID <61b1fac1c97bcae7b851.1395426487@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/4020/
State Accepted
Commit 202291a280fb6225bf7f811ed3b5ac6232c5b2af
Headers show

Comments

Pierre-Yves David - March 21, 2014, 6:28 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1395362042 25200
#      Thu Mar 20 17:34:02 2014 -0700
# Node ID 61b1fac1c97bcae7b851b2f3407d8a1f080dfc0b
# Parent  a2ee878b4dc367f62f9461761f3cd2ec33bd912c
revpair: drop useless conditional

The `if not revs:` case is tested at the beginning of the function.
Matt Mackall - March 21, 2014, 10:23 p.m.
On Fri, 2014-03-21 at 11:28 -0700, pierre-yves.david@ens-lyon.org wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@fb.com>
> # Date 1395362042 25200
> #      Thu Mar 20 17:34:02 2014 -0700
> # Node ID 61b1fac1c97bcae7b851b2f3407d8a1f080dfc0b
> # Parent  a2ee878b4dc367f62f9461761f3cd2ec33bd912c
> revpair: drop useless conditional

This one is queued for default, thanks.

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -469,13 +469,11 @@  def revpair(repo, revs):
         return repo.dirstate.p1(), None
 
     l = revrange(repo, revs)
 
     if len(l) == 0:
-        if revs:
-            raise util.Abort(_('empty revision range'))
-        return repo.dirstate.p1(), None
+        raise util.Abort(_('empty revision range'))
 
     if len(l) == 1 and len(revs) == 1 and _revrangesep not in revs[0]:
         return repo.lookup(l[0]), None
 
     return repo.lookup(l[0]), repo.lookup(l[-1])