changeset 10392:9be6c5900c07

localrepo: cleanup branch tip computation
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Mon, 08 Feb 2010 14:52:28 +0100
parents 935ef1836b2f
children 217703f760d1
files mercurial/localrepo.py
diffstat 1 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Mon Feb 08 06:24:34 2010 -0600
+++ b/mercurial/localrepo.py	Mon Feb 08 14:52:28 2010 +0100
@@ -350,16 +350,12 @@
         the branch, open heads come before closed'''
         bt = {}
         for bn, heads in self.branchmap().iteritems():
-            head = None
-            for i in range(len(heads)-1, -1, -1):
-                h = heads[i]
+            tip = heads[-1]
+            for h in reversed(heads):
                 if 'close' not in self.changelog.read(h)[5]:
-                    head = h
+                    tip = h
                     break
-            # no open heads were found
-            if head is None:
-                head = heads[-1]
-            bt[bn] = head
+            bt[bn] = tip
         return bt