Patchwork [04,of,10] revset: remove redundant condition and change to else from elif

login
register
mail settings
Submitter Pulkit Goyal
Date May 22, 2017, 8:52 p.m.
Message ID <7cb5bf075d4aa046f7b3.1495486334@workspace>
Download mbox | patch
Permalink /patch/20845/
State Accepted
Headers show

Comments

Pulkit Goyal - May 22, 2017, 8:52 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1495397280 -19800
#      Mon May 22 01:38:00 2017 +0530
# Node ID 7cb5bf075d4aa046f7b39149c720d63253d510d6
# Parent  a3b2977ae12717d214ca4f95a8816ca3339e5332
revset: remove redundant condition and change to else from elif

Before going to this piece of code, we already check whether n is in [0, 1, 2],
so dropping the redundant condition.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1506,7 +1506,7 @@ 
                 ps.add(cl.parentrevs(r)[0])
             except error.WdirUnsupported:
                 ps.add(repo[r].parents()[0].rev())
-        elif n == 2:
+        else:
             try:
                 parents = cl.parentrevs(r)
                 if parents[1] != node.nullrev: