comparison mercurial/branchmap.py @ 51453:bb8612053547

branchcache: fix the copy code We copy some internal attribute along too. This should prevent inconsistency in the resulting branchmap.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 19 Feb 2024 12:09:06 +0100
parents 5515876173ba
children 84fca6d79e25
comparison
equal deleted inserted replaced
51452:5515876173ba 51453:bb8612053547
430 """returns all the heads""" 430 """returns all the heads"""
431 self._verifyall() 431 self._verifyall()
432 return self._entries.values() 432 return self._entries.values()
433 433
434 def copy(self, repo): 434 def copy(self, repo):
435 """return an deep copy of the branchcache object""" 435 """return a deep copy of the branchcache object"""
436 return type(self)( 436 other = type(self)(
437 repo, 437 repo=repo,
438 self._entries, 438 # we always do a shally copy of self._entries, and the values is
439 self.tipnode, 439 # always replaced, so no need to deepcopy until the above remains
440 self.tiprev, 440 # true.
441 self.filteredhash, 441 entries=self._entries,
442 self._closednodes, 442 tipnode=self.tipnode,
443 tiprev=self.tiprev,
444 filteredhash=self.filteredhash,
445 closednodes=set(self._closednodes),
443 verify_node=self._verify_node, 446 verify_node=self._verify_node,
444 ) 447 )
448 # we copy will likely schedule a write anyway, but that does not seems
449 # to hurt to overschedule
450 other._delayed = self._delayed
451 # also copy information about the current verification state
452 other._closedverified = self._closedverified
453 other._verifiedbranches = set(self._verifiedbranches)
454 return other
445 455
446 def write(self, repo): 456 def write(self, repo):
447 assert self._filtername == repo.filtername, ( 457 assert self._filtername == repo.filtername, (
448 self._filtername, 458 self._filtername,
449 repo.filtername, 459 repo.filtername,