Show More
@@ -2186,20 +2186,17 b' def reposetup(ui, repo):' | |||
|
2186 | 2186 | |
|
2187 | 2187 | return tagscache |
|
2188 | 2188 | |
|
2189 | def _branchtags(self): | |
|
2189 | def _branchtags(self, partial, lrev): | |
|
2190 | 2190 | q = self.mq |
|
2191 | 2191 | if not q.applied: |
|
2192 | return super(mqrepo, self)._branchtags() | |
|
2192 | return super(mqrepo, self)._branchtags(partial, lrev) | |
|
2193 | 2193 | |
|
2194 | 2194 | cl = self.changelog |
|
2195 | 2195 | qbasenode = revlog.bin(q.applied[0].rev) |
|
2196 | 2196 | if qbasenode not in cl.nodemap: |
|
2197 | 2197 | self.ui.warn('mq status file refers to unknown node %s\n' |
|
2198 | 2198 | % revlog.short(qbasenode)) |
|
2199 | return super(mqrepo, self)._branchtags() | |
|
2200 | ||
|
2201 | self.branchcache = {} # avoid recursion in changectx | |
|
2202 | partial, last, lrev = self._readbranchcache() | |
|
2199 | return super(mqrepo, self)._branchtags(partial, lrev) | |
|
2203 | 2200 | |
|
2204 | 2201 | qbase = cl.rev(qbasenode) |
|
2205 | 2202 | start = lrev + 1 |
@@ -94,6 +94,8 b' class localrepository(repo.repository):' | |||
|
94 | 94 | self.tagscache = None |
|
95 | 95 | self._tagstypecache = None |
|
96 | 96 | self.branchcache = None |
|
97 | self._ubranchcache = None # UTF-8 version of branchcache | |
|
98 | self._branchcachetip = None | |
|
97 | 99 | self.nodetagscache = None |
|
98 | 100 | self.filterpats = {} |
|
99 | 101 | self._datafilters = {} |
@@ -344,9 +346,7 b' class localrepository(repo.repository):' | |||
|
344 | 346 | self.nodetagscache.setdefault(n, []).append(t) |
|
345 | 347 | return self.nodetagscache.get(node, []) |
|
346 | 348 | |
|
347 | def _branchtags(self): | |
|
348 | partial, last, lrev = self._readbranchcache() | |
|
349 | ||
|
349 | def _branchtags(self, partial, lrev): | |
|
350 | 350 | tiprev = self.changelog.count() - 1 |
|
351 | 351 | if lrev != tiprev: |
|
352 | 352 | self._updatebranchcache(partial, lrev+1, tiprev+1) |
@@ -355,16 +355,29 b' class localrepository(repo.repository):' | |||
|
355 | 355 | return partial |
|
356 | 356 | |
|
357 | 357 | def branchtags(self): |
|
358 | if self.branchcache is not None: | |
|
358 | tip = self.changelog.tip() | |
|
359 | if self.branchcache is not None and self._branchcachetip == tip: | |
|
359 | 360 | return self.branchcache |
|
360 | 361 | |
|
362 | oldtip = self._branchcachetip | |
|
363 | self._branchcachetip = tip | |
|
364 | if self.branchcache is None: | |
|
361 | 365 | self.branchcache = {} # avoid recursion in changectx |
|
362 | partial = self._branchtags() | |
|
366 | else: | |
|
367 | self.branchcache.clear() # keep using the same dict | |
|
368 | if oldtip is None or oldtip not in self.changelog.nodemap: | |
|
369 | partial, last, lrev = self._readbranchcache() | |
|
370 | else: | |
|
371 | lrev = self.changelog.rev(oldtip) | |
|
372 | partial = self._ubranchcache | |
|
373 | ||
|
374 | self._branchtags(partial, lrev) | |
|
363 | 375 | |
|
364 | 376 | # the branch cache is stored on disk as UTF-8, but in the local |
|
365 | 377 | # charset internally |
|
366 | 378 | for k, v in partial.items(): |
|
367 | 379 | self.branchcache[util.tolocal(k)] = v |
|
380 | self._ubranchcache = partial | |
|
368 | 381 | return self.branchcache |
|
369 | 382 | |
|
370 | 383 | def _readbranchcache(self): |
@@ -616,6 +629,9 b' class localrepository(repo.repository):' | |||
|
616 | 629 | self.tagscache = None |
|
617 | 630 | self._tagstypecache = None |
|
618 | 631 | self.nodetagscache = None |
|
632 | self.branchcache = None | |
|
633 | self._ubranchcache = None | |
|
634 | self._branchcachetip = None | |
|
619 | 635 | |
|
620 | 636 | def _lock(self, lockname, wait, releasefn, acquirefn, desc): |
|
621 | 637 | try: |
@@ -882,8 +898,8 b' class localrepository(repo.repository):' | |||
|
882 | 898 | parent2=xp2) |
|
883 | 899 | tr.close() |
|
884 | 900 | |
|
885 |
if self.branchcache |
|
|
886 |
self.branch |
|
|
901 | if self.branchcache: | |
|
902 | self.branchtags() | |
|
887 | 903 | |
|
888 | 904 | if use_dirstate or update_dirstate: |
|
889 | 905 | self.dirstate.setparents(n) |
@@ -2005,7 +2021,6 b' class localrepository(repo.repository):' | |||
|
2005 | 2021 | if changesets > 0: |
|
2006 | 2022 | # forcefully update the on-disk branch cache |
|
2007 | 2023 | self.ui.debug(_("updating the branch cache\n")) |
|
2008 | self.branchcache = None | |
|
2009 | 2024 | self.branchtags() |
|
2010 | 2025 | self.hook("changegroup", node=hex(self.changelog.node(cor+1)), |
|
2011 | 2026 | source=srctype, url=url) |
General Comments 0
You need to be logged in to leave comments.
Login now