Mercurial > hg
comparison mercurial/localrepo.py @ 6120:f89878df40fe
move the reading of branch.cache from _branchtags to branchtags
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 15 Feb 2008 16:06:36 -0200 |
parents | b8919d401313 |
children | 7336aeff1a1d |
comparison
equal
deleted
inserted
replaced
6119:b8919d401313 | 6120:f89878df40fe |
---|---|
343 self.nodetagscache = {} | 343 self.nodetagscache = {} |
344 for t, n in self.tags().items(): | 344 for t, n in self.tags().items(): |
345 self.nodetagscache.setdefault(n, []).append(t) | 345 self.nodetagscache.setdefault(n, []).append(t) |
346 return self.nodetagscache.get(node, []) | 346 return self.nodetagscache.get(node, []) |
347 | 347 |
348 def _branchtags(self): | 348 def _branchtags(self, partial, lrev): |
349 partial, last, lrev = self._readbranchcache() | |
350 | |
351 tiprev = self.changelog.count() - 1 | 349 tiprev = self.changelog.count() - 1 |
352 if lrev != tiprev: | 350 if lrev != tiprev: |
353 self._updatebranchcache(partial, lrev+1, tiprev+1) | 351 self._updatebranchcache(partial, lrev+1, tiprev+1) |
354 self._writebranchcache(partial, self.changelog.tip(), tiprev) | 352 self._writebranchcache(partial, self.changelog.tip(), tiprev) |
355 | 353 |
358 def branchtags(self): | 356 def branchtags(self): |
359 if self.branchcache is not None: | 357 if self.branchcache is not None: |
360 return self.branchcache | 358 return self.branchcache |
361 | 359 |
362 self.branchcache = {} # avoid recursion in changectx | 360 self.branchcache = {} # avoid recursion in changectx |
363 partial = self._branchtags() | 361 partial, last, lrev = self._readbranchcache() |
362 self._branchtags(partial, lrev) | |
364 | 363 |
365 # the branch cache is stored on disk as UTF-8, but in the local | 364 # the branch cache is stored on disk as UTF-8, but in the local |
366 # charset internally | 365 # charset internally |
367 for k, v in partial.items(): | 366 for k, v in partial.items(): |
368 self.branchcache[util.tolocal(k)] = v | 367 self.branchcache[util.tolocal(k)] = v |