[PATCH 2 of 6 RFC] destutil: remove redundant examination

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Feb 24 09:17:10 EST 2016


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1456322432 -32400
#      Wed Feb 24 23:00:32 2016 +0900
# Node ID 8938e21bbd1458d43b67697c941ba5eb66c75d76
# Parent  609548f6366bcc6d310dbea042f68902f3f67dce
destutil: remove redundant examination

Before this patch, "len(heads) != len(otherheads)" is examined to
detect whether message should be displayed or not.

But if "repo.revs('%ln and parents()', heads)", heads should contain
"parents()" and otherheads is always less than heads.

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -357,11 +357,10 @@ def _statusotherbook(ui, repo):
 def _statusotherbranchheads(ui, repo):
     currentbranch = repo.dirstate.branch()
     heads = repo.branchheads(currentbranch)
-    l = len(heads)
     if repo.revs('%ln and parents()', heads):
         # we are on a head
         otherheads = repo.revs('%ln - parents()', heads)
-        if otherheads and l != len(otherheads):
+        if otherheads:
             ui.status(_('%i other heads for branch "%s"\n') %
                       (len(otherheads), currentbranch))
 


More information about the Mercurial-devel mailing list