Patchwork D9032: mergestate: simplify reset(), knowing that `other` and `node` go together

login
register
mail settings
Submitter phabricator
Date Sept. 17, 2020, 8:11 p.m.
Message ID <differential-rev-PHID-DREV-yf4k5d2oovszp3abgs4v-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47192/
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
  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`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -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