##// END OF EJS Templates
revbranchcache: move out of branchmap onto localrepo...
Durham Goode -
r24373:59cc0924 default
parent child Browse files
Show More
@@ -96,6 +96,10 b' def updatecache(repo):'
96 96 if revs:
97 97 partial.update(repo, revs)
98 98 partial.write(repo)
99
100 if repo._revbranchcache is not None:
101 repo._revbranchcache.write(repo)
102
99 103 assert partial.validfor(repo), filtername
100 104 repo._branchcaches[repo.filtername] = partial
101 105
@@ -134,7 +138,6 b' class branchcache(dict):'
134 138 self._closednodes = set()
135 139 else:
136 140 self._closednodes = closednodes
137 self._revbranchcache = None
138 141
139 142 def _hashfiltered(self, repo):
140 143 """build hash of revision filtered in the current cache
@@ -226,9 +229,6 b' class branchcache(dict):'
226 229 repo.ui.debug("couldn't write branch cache: %s\n" % inst)
227 230 # Abort may be raise by read only opener
228 231 pass
229 if self._revbranchcache:
230 self._revbranchcache.write(repo.unfiltered())
231 self._revbranchcache = None
232 232
233 233 def update(self, repo, revgen):
234 234 """Given a branchhead cache, self, that may have extra nodes or be
@@ -240,9 +240,8 b' class branchcache(dict):'
240 240 # collect new branch entries
241 241 newbranches = {}
242 242 urepo = repo.unfiltered()
243 self._revbranchcache = revbranchcache(urepo)
244 getbranchinfo = self._revbranchcache.branchinfo
245 243 ucl = urepo.changelog
244 getbranchinfo = repo.revbranchcache().branchinfo
246 245 for r in revgen:
247 246 branch, closesbranch = getbranchinfo(ucl, r)
248 247 newbranches.setdefault(branch, []).append(r)
@@ -279,6 +279,7 b' class localrepository(object):'
279 279
280 280
281 281 self._branchcaches = {}
282 self._revbranchcache = None
282 283 self.filterpats = {}
283 284 self._datafilters = {}
284 285 self._transref = self._lockref = self._wlockref = None
@@ -726,6 +727,12 b' class localrepository(object):'
726 727 branchmap.updatecache(self)
727 728 return self._branchcaches[self.filtername]
728 729
730 @unfilteredmethod
731 def revbranchcache(self):
732 if not self._revbranchcache:
733 self._revbranchcache = branchmap.revbranchcache(self.unfiltered())
734 return self._revbranchcache
735
729 736 def branchtip(self, branch, ignoremissing=False):
730 737 '''return the tip node for a given branch
731 738
@@ -141,6 +141,7 b' class statichttprepository(localrepo.loc'
141 141 self._tags = None
142 142 self.nodetagscache = None
143 143 self._branchcaches = {}
144 self._revbranchcache = None
144 145 self.encodepats = None
145 146 self.decodepats = None
146 147
General Comments 0
You need to be logged in to leave comments. Login now