Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Sep 2020 19:33:55 -0700] rev 45506
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
Martin von Zweigbergk <martinvonz@google.com> [Wed, 16 Sep 2020 13:25:49 -0700] rev 45505
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
Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Sep 2020 09:23:21 -0700] rev 45504
mergestate: make clean() only be about creating a clean mergestate
This is similar to the previous patch, but moves the separation one
step further out, to `merge.py`.
Differential Revision: https://phab.mercurial-scm.org/D9034
Martin von Zweigbergk <martinvonz@google.com> [Wed, 16 Sep 2020 10:09:37 -0700] rev 45503
mergestate: split up reset() for its two use cases
We only have one place that calls `ms.reset()` with any
arguments. That place is `mergestate.clean()`. The callers that call
the function with no arguments seem to all just want delete the
mergestate -- none of them look at the instance after calling
`reset()`. Let's separate out the two different use cases to make the
code clearer. I'll clean up further soon.
Differential Revision: https://phab.mercurial-scm.org/D9033
Martin von Zweigbergk <martinvonz@google.com> [Tue, 15 Sep 2020 23:19:14 -0700] rev 45502
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
Martin von Zweigbergk <martinvonz@google.com> [Tue, 15 Sep 2020 22:40:26 -0700] rev 45501
mergestate: make some callers not pass pointless node argument
The node argument is set on the created `mergestate` instance, but
these callers don't even look at that instance.
Differential Revision: https://phab.mercurial-scm.org/D9031
Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Sep 2020 09:56:05 -0700] rev 45500
py3: don't risk passing a None value to error.ManifestLookupError()
This makes the test case added in 20dd2a259b0f (test-grep: add tests
for --follow with/without --diff and/or paths, 2020-09-11) pass on
Python 3.
Differential Revision: https://phab.mercurial-scm.org/D9030