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