# HG changeset patch # User Pierre-Yves David # Date 1708340946 -3600 # Node ID bb86120535476fbed493392ef95dcb248e8fcd9a # Parent 5515876173ba168ef5573e8ef19982fe554feffd branchcache: fix the copy code We copy some internal attribute along too. This should prevent inconsistency in the resulting branchmap. diff -r 5515876173ba -r bb8612053547 mercurial/branchmap.py --- a/mercurial/branchmap.py Mon Feb 19 13:11:42 2024 +0100 +++ b/mercurial/branchmap.py Mon Feb 19 12:09:06 2024 +0100 @@ -432,16 +432,26 @@ return self._entries.values() def copy(self, repo): - """return an deep copy of the branchcache object""" - return type(self)( - repo, - self._entries, - self.tipnode, - self.tiprev, - self.filteredhash, - self._closednodes, + """return a deep copy of the branchcache object""" + other = type(self)( + repo=repo, + # we always do a shally copy of self._entries, and the values is + # always replaced, so no need to deepcopy until the above remains + # true. + entries=self._entries, + tipnode=self.tipnode, + tiprev=self.tiprev, + filteredhash=self.filteredhash, + closednodes=set(self._closednodes), verify_node=self._verify_node, ) + # we copy will likely schedule a write anyway, but that does not seems + # to hurt to overschedule + other._delayed = self._delayed + # also copy information about the current verification state + other._closedverified = self._closedverified + other._verifiedbranches = set(self._verifiedbranches) + return other def write(self, repo): assert self._filtername == repo.filtername, (