changeset 9120:d3b995dd4eab

branch heads: optimise computation of branch head cache (issue1734) The previous branch heads cache implementation iterated all ancestors for each new revision in the repository, causing a massive slowdown on cloning larger repositories.
author Henrik Stuart <hg@hstuart.dk>
date Mon, 13 Jul 2009 20:19:17 +0200
parents 78e54b9f3a62
children a85a3d398cc3 a5c060b80082
files mercurial/localrepo.py
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sun Jul 12 00:46:43 2009 -0500
+++ b/mercurial/localrepo.py	Mon Jul 13 20:19:17 2009 +0200
@@ -473,9 +473,8 @@
                 latest = newnodes.pop()
                 if latest not in bheads:
                     continue
-                reachable = set()
-                for bh in bheads:
-                    reachable |= self.changelog.reachable(latest, bh)
+                minbhrev = self[min([self[bh].rev() for bh in bheads])].node()
+                reachable = self.changelog.reachable(latest, minbhrev)
                 bheads = [b for b in bheads if b not in reachable]
                 newbheads.insert(0, latest)
             bheads.extend(newbheads)