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