Show More
@@ -95,6 +95,7 class localrepository(repo.repository): | |||||
95 | self._tagstypecache = None |
|
95 | self._tagstypecache = None | |
96 | self.branchcache = None |
|
96 | self.branchcache = None | |
97 | self._ubranchcache = None # UTF-8 version of branchcache |
|
97 | self._ubranchcache = None # UTF-8 version of branchcache | |
|
98 | self._branchcachetip = None | |||
98 | self.nodetagscache = None |
|
99 | self.nodetagscache = None | |
99 | self.filterpats = {} |
|
100 | self.filterpats = {} | |
100 | self._datafilters = {} |
|
101 | self._datafilters = {} | |
@@ -354,11 +355,22 class localrepository(repo.repository): | |||||
354 | return partial |
|
355 | return partial | |
355 |
|
356 | |||
356 | def branchtags(self): |
|
357 | def branchtags(self): | |
357 | if self.branchcache is not None: |
|
358 | tip = self.changelog.tip() | |
|
359 | if self.branchcache is not None and self._branchcachetip == tip: | |||
358 | return self.branchcache |
|
360 | return self.branchcache | |
359 |
|
361 | |||
|
362 | oldtip = self._branchcachetip | |||
|
363 | self._branchcachetip = tip | |||
|
364 | if self.branchcache is None: | |||
360 | self.branchcache = {} # avoid recursion in changectx |
|
365 | self.branchcache = {} # avoid recursion in changectx | |
|
366 | else: | |||
|
367 | self.branchcache.clear() # keep using the same dict | |||
|
368 | if oldtip is None or oldtip not in self.changelog.nodemap: | |||
361 | partial, last, lrev = self._readbranchcache() |
|
369 | partial, last, lrev = self._readbranchcache() | |
|
370 | else: | |||
|
371 | lrev = self.changelog.rev(oldtip) | |||
|
372 | partial = self._ubranchcache | |||
|
373 | ||||
362 | self._branchtags(partial, lrev) |
|
374 | self._branchtags(partial, lrev) | |
363 |
|
375 | |||
364 | # the branch cache is stored on disk as UTF-8, but in the local |
|
376 | # the branch cache is stored on disk as UTF-8, but in the local | |
@@ -619,6 +631,7 class localrepository(repo.repository): | |||||
619 | self.nodetagscache = None |
|
631 | self.nodetagscache = None | |
620 | self.branchcache = None |
|
632 | self.branchcache = None | |
621 | self._ubranchcache = None |
|
633 | self._ubranchcache = None | |
|
634 | self._branchcachetip = None | |||
622 |
|
635 | |||
623 | def _lock(self, lockname, wait, releasefn, acquirefn, desc): |
|
636 | def _lock(self, lockname, wait, releasefn, acquirefn, desc): | |
624 | try: |
|
637 | try: | |
@@ -885,8 +898,8 class localrepository(repo.repository): | |||||
885 | parent2=xp2) |
|
898 | parent2=xp2) | |
886 | tr.close() |
|
899 | tr.close() | |
887 |
|
900 | |||
888 |
if self.branchcache |
|
901 | if self.branchcache: | |
889 |
self.branch |
|
902 | self.branchtags() | |
890 |
|
903 | |||
891 | if use_dirstate or update_dirstate: |
|
904 | if use_dirstate or update_dirstate: | |
892 | self.dirstate.setparents(n) |
|
905 | self.dirstate.setparents(n) | |
@@ -2008,7 +2021,6 class localrepository(repo.repository): | |||||
2008 | if changesets > 0: |
|
2021 | if changesets > 0: | |
2009 | # forcefully update the on-disk branch cache |
|
2022 | # forcefully update the on-disk branch cache | |
2010 | self.ui.debug(_("updating the branch cache\n")) |
|
2023 | self.ui.debug(_("updating the branch cache\n")) | |
2011 | self.branchcache = None |
|
|||
2012 | self.branchtags() |
|
2024 | self.branchtags() | |
2013 | self.hook("changegroup", node=hex(self.changelog.node(cor+1)), |
|
2025 | self.hook("changegroup", node=hex(self.changelog.node(cor+1)), | |
2014 | source=srctype, url=url) |
|
2026 | source=srctype, url=url) |
General Comments 0
You need to be logged in to leave comments.
Login now