##// END OF EJS Templates
branchcache: move the processing of the new data in a dedicated method...
marmoute -
r52428:03247e37 default
parent child Browse files
Show More
@@ -307,13 +307,46 b' class _BaseBranchCache:'
307 msg = "running branchcache.update without revision to update"
307 msg = "running branchcache.update without revision to update"
308 raise error.ProgrammingError(msg)
308 raise error.ProgrammingError(msg)
309
309
310 self._process_new(
311 repo,
312 newbranches,
313 new_closed,
314 obs_ignored,
315 max_rev,
316 )
317
318 self._closednodes.update(cl.node(rev) for rev in new_closed)
319
320 duration = util.timer() - starttime
321 repo.ui.log(
322 b'branchcache',
323 b'updated %s in %.4f seconds\n',
324 _branchcachedesc(repo),
325 duration,
326 )
327 return max_rev
328
329 def _process_new(
330 self,
331 repo,
332 newbranches,
333 new_closed,
334 obs_ignored,
335 max_rev,
336 ):
337 """update the branchmap from a set of new information"""
310 # Delay fetching the topological heads until they are needed.
338 # Delay fetching the topological heads until they are needed.
311 # A repository without non-continous branches can skip this part.
339 # A repository without non-continous branches can skip this part.
312 topoheads = None
340 topoheads = None
313
341
342 cl = repo.changelog
343 getbranchinfo = repo.revbranchcache().branchinfo
344 # Faster than using ctx.obsolete()
345 obsrevs = obsolete.getrevs(repo, b'obsolete')
346
314 # If a changeset is visible, its parents must be visible too, so
347 # If a changeset is visible, its parents must be visible too, so
315 # use the faster unfiltered parent accessor.
348 # use the faster unfiltered parent accessor.
316 parentrevs = repo.unfiltered().changelog.parentrevs
349 parentrevs = cl._uncheckedparentrevs
317
350
318 for branch, newheadrevs in newbranches.items():
351 for branch, newheadrevs in newbranches.items():
319 # For every branch, compute the new branchheads.
352 # For every branch, compute the new branchheads.
@@ -392,17 +425,6 b' class _BaseBranchCache:'
392 if bheadset:
425 if bheadset:
393 self[branch] = [cl.node(rev) for rev in sorted(bheadset)]
426 self[branch] = [cl.node(rev) for rev in sorted(bheadset)]
394
427
395 self._closednodes.update(cl.node(rev) for rev in new_closed)
396
397 duration = util.timer() - starttime
398 repo.ui.log(
399 b'branchcache',
400 b'updated %s in %.4f seconds\n',
401 _branchcachedesc(repo),
402 duration,
403 )
404 return max_rev
405
406
428
407 STATE_CLEAN = 1
429 STATE_CLEAN = 1
408 STATE_INHERITED = 2
430 STATE_INHERITED = 2
General Comments 0
You need to be logged in to leave comments. Login now