Mercurial > hg-stable
changeset 12066:d01e28657429
localrepo: introduce method for explicit branch cache update
Currently, localrepo.branchtags() is called in two locations to update the
_branchcache dict, however branchtags() itself does not update anything, it
calls branchmap() to do so. This change introduces a new updatebranchcache()
method that is used by both branchmap() and the calls to update the cache.
author | Georg Brandl <georg@python.org> |
---|---|
date | Sat, 28 Aug 2010 23:57:39 +0200 |
parents | a8b1cb0b0ddb |
children | fddacca3202e |
files | mercurial/localrepo.py |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/localrepo.py Fri Aug 27 22:24:47 2010 -0500 +++ b/mercurial/localrepo.py Sat Aug 28 23:57:39 2010 +0200 @@ -337,8 +337,7 @@ return partial - def branchmap(self): - '''returns a dictionary {branch: [branchheads]}''' + def updatebranchcache(self): tip = self.changelog.tip() if self._branchcache is not None and self._branchcachetip == tip: return self._branchcache @@ -355,6 +354,9 @@ # this private cache holds all heads (not just tips) self._branchcache = partial + def branchmap(self): + '''returns a dictionary {branch: [branchheads]}''' + self.updatebranchcache() return self._branchcache def branchtags(self): @@ -976,7 +978,7 @@ tr.close() if self._branchcache: - self.branchtags() + self.updatebranchcache() return n finally: if tr: @@ -1700,7 +1702,7 @@ if changesets > 0: # forcefully update the on-disk branch cache self.ui.debug("updating the branch cache\n") - self.branchtags() + self.updatebranchcache() self.hook("changegroup", node=hex(cl.node(clstart)), source=srctype, url=url)