comparison mercurial/branchmap.py @ 51487:18c2753434f2

branchcache: explicitly assert that copy is always about inheritance This would catch cases where copy is used for something else if any existed.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 08 Mar 2024 16:52:08 +0100
parents 659f766629c8
children dd5b5f99940d
comparison
equal deleted inserted replaced
51486:659f766629c8 51487:18c2753434f2
554 filename = b'%s-%s' % (filename, repo.filtername) 554 filename = b'%s-%s' % (filename, repo.filtername)
555 return filename 555 return filename
556 556
557 def copy(self, repo): 557 def copy(self, repo):
558 """return a deep copy of the branchcache object""" 558 """return a deep copy of the branchcache object"""
559 assert repo.filtername != self._filtername
559 other = type(self)( 560 other = type(self)(
560 repo=repo, 561 repo=repo,
561 # we always do a shally copy of self._entries, and the values is 562 # we always do a shally copy of self._entries, and the values is
562 # always replaced, so no need to deepcopy until the above remains 563 # always replaced, so no need to deepcopy until the above remains
563 # true. 564 # true.