# HG changeset patch # User Pierre-Yves David # Date 1357604919 -3600 # Node ID 2502a15e033d693bbf0651173d1762a337f7b8cf # Parent 9b6ae29d4801de6d6754a6ede7a6de61671e3651 branchmap: pass revision insteads of changectx to the update function Creation of changectx objects is very slow, and they are not very useful. We are going to drop them. The first step is to change the function argument type. diff -r 9b6ae29d4801 -r 2502a15e033d mercurial/branchmap.py --- a/mercurial/branchmap.py Fri Jan 11 18:39:43 2013 +0100 +++ b/mercurial/branchmap.py Tue Jan 08 01:28:39 2013 +0100 @@ -77,8 +77,7 @@ revs.extend(r for r in extrarevs if r <= partial.tiprev) revs.extend(cl.revs(start=partial.tiprev + 1)) if revs: - ctxgen = (repo[r] for r in revs) - partial.update(repo, ctxgen) + partial.update(repo, revs) partial.write(repo) assert partial.validfor(repo) repo._branchcaches[repo.filtername] = partial @@ -144,12 +143,13 @@ # Abort may be raise by read only opener pass - def update(self, repo, ctxgen): + def update(self, repo, revgen): """Given a branchhead cache, self, that may have extra nodes or be missing heads, and a generator of nodes that are at least a superset of heads missing, this function updates self to be correct. """ cl = repo.changelog + ctxgen = (repo[r] for r in revgen) # collect new branch entries newbranches = {} for c in ctxgen: diff -r 9b6ae29d4801 -r 2502a15e033d mercurial/discovery.py --- a/mercurial/discovery.py Fri Jan 11 18:39:43 2013 +0100 +++ b/mercurial/discovery.py Tue Jan 08 01:28:39 2013 +0100 @@ -196,7 +196,7 @@ newmap = branchmap.branchcache((branch, heads[1]) for branch, heads in headssum.iteritems() if heads[0] is not None) - newmap.update(repo, missingctx) + newmap.update(repo, (ctx.rev() for ctx in missingctx)) for branch, newheads in newmap.iteritems(): headssum[branch][1][:] = newheads return headssum diff -r 9b6ae29d4801 -r 2502a15e033d mercurial/localrepo.py --- a/mercurial/localrepo.py Fri Jan 11 18:39:43 2013 +0100 +++ b/mercurial/localrepo.py Tue Jan 08 01:28:39 2013 +0100 @@ -1406,10 +1406,11 @@ # it, Otherwise, since nodes were destroyed, the cache is stale and this # will be caught the next time it is read. if newheadnodes: - ctxgen = (self[node] for node in newheadnodes - if self.changelog.hasnode(node)) + cl = self.changelog + revgen = (cl.rev(node) for node in newheadnodes + if cl.hasnode(node)) cache = self._branchcaches[None] - cache.update(self, ctxgen) + cache.update(self, revgen) cache.write(self) # Ensure the persistent tag cache is updated. Doing it now