changeset 45506:3dd481e11c25

mergestate: remove unnecessary clearing of `localctx` and `otherctx` As noted in the previous commit, there are no callers that (re-)use the instance after calling `reset()`. There are also no callers that call `_read()` after doing anything with the instance (it's only called right after an instance is created). If reviewers feel that this is too risky, I can extract and reuse the poisoning code that indygreg once added for poisining repo instances. Differential Revision: https://phab.mercurial-scm.org/D9036
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 17 Sep 2020 19:33:55 -0700
parents 9ea4b52ac6bb
children ef3273ac5f6e
files mercurial/mergestate.py
diffstat 1 files changed, 0 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/mergestate.py	Wed Sep 16 13:25:49 2020 -0700
+++ b/mercurial/mergestate.py	Thu Sep 17 19:33:55 2020 -0700
@@ -12,7 +12,6 @@
     nullhex,
     nullid,
 )
-from .pycompat import delattr
 from . import (
     error,
     filemerge,
@@ -208,9 +207,6 @@
         self._labels = labels
         self._state = {}
         self._stateextras = collections.defaultdict(dict)
-        for var in ('localctx', 'otherctx'):
-            if var in vars(self):
-                delattr(self, var)
         self._readmergedriver = None
         if self.mergedriver:
             self._mdstate = MERGE_DRIVER_STATE_SUCCESS
@@ -229,9 +225,6 @@
         self._stateextras = collections.defaultdict(dict)
         self._local = None
         self._other = None
-        for var in ('localctx', 'otherctx'):
-            if var in vars(self):
-                delattr(self, var)
         self._readmergedriver = None
         self._mdstate = MERGE_DRIVER_STATE_SUCCESS
         unsupported = set()