# HG changeset patch # User Benoit Boissinot # Date 2010-02-08 13:52:28 # Node ID 9be6c5900c07eea45b7804200775e5cd52809b84 # Parent 935ef1836b2f6172c1b003fa751a5b327a9bae7e localrepo: cleanup branch tip computation diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -350,16 +350,12 @@ class localrepository(repo.repository): 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