mergestate: simplify reset(), knowing that `other` and `node` go together
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 15 Sep 2020 23:19:14 -0700
changeset 45502 aad11a26a054
parent 45501 0ce6af73f481
child 45503 08c6d6962b2a
mergestate: simplify reset(), knowing that `other` and `node` go together There's only one caller of `reset()` that passes any arguments at all, and that originates from `merge.py:1371`. That code always passes values for both `node` and `other`. Differential Revision: https://phab.mercurial-scm.org/D9032
mercurial/mergestate.py
--- a/mercurial/mergestate.py	Tue Sep 15 22:40:26 2020 -0700
+++ b/mercurial/mergestate.py	Tue Sep 15 23:19:14 2020 -0700
@@ -202,15 +202,12 @@
     def reset(self, node=None, other=None, labels=None):
         self._state = {}
         self._stateextras = collections.defaultdict(dict)
-        self._local = None
-        self._other = None
+        self._local = node
+        self._other = other
         self._labels = labels
         for var in ('localctx', 'otherctx'):
             if var in vars(self):
                 delattr(self, var)
-        if node:
-            self._local = node
-            self._other = other
         self._readmergedriver = None
         if self.mergedriver:
             self._mdstate = MERGE_DRIVER_STATE_SUCCESS