mergestate: update _stateextras instead of reassinging
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 25 Sep 2020 13:58:05 +0530
changeset 45583 9f14bb4d59ea
parent 45582 463ca8af8c72
child 45584 4c8a93ec6908
mergestate: update _stateextras instead of reassinging `merge.applyupdates()` can store extras for a file and _stateextras may not be empty always. Hence reassigning loses the old values. We can directly update like this because we switched to using `collections.defaultdict` for `_stateextras` sometime ago.
mercurial/mergestate.py
--- a/mercurial/mergestate.py	Mon Sep 14 14:11:45 2020 +0530
+++ b/mercurial/mergestate.py	Fri Sep 25 13:58:05 2020 +0530
@@ -261,7 +261,7 @@
             hex(fco.filenode()),
             fcl.flags(),
         ]
-        self._stateextras[fd] = {b'ancestorlinknode': hex(fca.node())}
+        self._stateextras[fd][b'ancestorlinknode'] = hex(fca.node())
         self._dirty = True
 
     def addpathconflict(self, path, frename, forigin):