Mercurial > hg
changeset 45494:9ea4b52ac6bb
mergestate: move most of of reset() into start()
`ms.reset()` has somehow become a combination of two different things:
1. A constructor-like function creating an empty instance
2. A call to `shutil.rmtree()` to clear the mergestate.
It seems that all callers now care only about the latter (since we
changed one caller to use the new `ms.start()` method instead). Let's
move the code for the former into `start()`, since that's the only
place it's needed.
Differential Revision: https://phab.mercurial-scm.org/D9035
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 16 Sep 2020 13:25:49 -0700 |
parents | 2c10876bb320 |
children | 3dd481e11c25 |
files | mercurial/mergestate.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/mergestate.py Thu Sep 17 09:23:21 2020 -0700 +++ b/mercurial/mergestate.py Wed Sep 16 13:25:49 2020 -0700 @@ -200,6 +200,12 @@ self._labels = None def reset(self): + shutil.rmtree(self._repo.vfs.join(b'merge'), True) + + def start(self, node, other, labels=None): + self._local = node + self._other = other + self._labels = labels self._state = {} self._stateextras = collections.defaultdict(dict) for var in ('localctx', 'otherctx'): @@ -210,15 +216,9 @@ self._mdstate = MERGE_DRIVER_STATE_SUCCESS else: self._mdstate = MERGE_DRIVER_STATE_UNMARKED - shutil.rmtree(self._repo.vfs.join(b'merge'), True) self._results = {} self._dirty = False - def start(self, node, other, labels=None): - self._local = node - self._other = other - self._labels = labels - def _read(self): """Analyse each record content to restore a serialized state from disk