Patchwork D9036: mergestate: remove unnecessary clearing of `localctx` and `otherctx`

login
register
mail settings
Submitter phabricator
Date Sept. 17, 2020, 8:11 p.m.
Message ID <differential-rev-PHID-DREV-h3227ieifchd4sv6sx3u-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47195/
State Superseded
Headers show

Comments

phabricator - Sept. 17, 2020, 8:11 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9036

AFFECTED FILES
  mercurial/mergestate.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py
--- a/mercurial/mergestate.py
+++ b/mercurial/mergestate.py
@@ -208,9 +208,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 +226,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()