[PATCH] localrepo: fix bugs in branchheads

Sune Foldager cryo at cyanite.org
Wed Sep 23 05:56:30 CDT 2009


# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1253703203 -7200
# Node ID 9a335e3dc705fb3f3873c554d18634dadd673099
# Parent  a15813fae0a8f414228f9da768c235f9d017ebfa
localrepo: fix bugs in branchheads

1. The call to reverse() reversed the list in place in the global branchmap.
2. The nodesbetween function doesn't preserve ordering.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1164,12 +1164,12 @@
         branches = self.branchmap()
         if branch not in branches:
             return []
-        bheads = branches[branch]
         # the cache returns heads ordered lowest to highest
-        bheads.reverse()
+        bheads = list(reversed(branches[branch]))
         if start is not None:
             # filter out the heads that cannot be reached from startrev
-            bheads = self.changelog.nodesbetween([start], bheads)[2]
+            fbheads = set(self.changelog.nodesbetween([start], bheads)[2])
+            bheads = [h for h in bheads if h in fbheads]
         if not closed:
             bheads = [h for h in bheads if
                       ('close' not in self.changelog.read(h)[5])]


More information about the Mercurial-devel mailing list