Martin von Zweigbergk <martinvonz@google.com> [Tue, 15 Sep 2020 11:17:24 -0700] rev 45498
mergestate: extract a base class to be shared by future memmergestate
This extracts a new base class from `mergestate` and leaves all the
vfs-touching code in `mergestate`.
Differential Revision: https://phab.mercurial-scm.org/D9039
Martin von Zweigbergk <martinvonz@google.com> [Tue, 15 Sep 2020 11:33:26 -0700] rev 45497
mergestate: extract overridable methods for making/restoring file backups
In-memory merge currently still uses on-disk mergestate. That's mostly
harmless (I don't think I've seen any problem it's actually
caused). It's still a little weird. I'm planning to add an in-memory
mergestate, which will be used with `overlayworkingctx`. This patch
prepares for that by extracting that logic, so it's easier to change
per subclass.
Differential Revision: https://phab.mercurial-scm.org/D9038
Martin von Zweigbergk <martinvonz@google.com> [Wed, 16 Sep 2020 13:39:26 -0700] rev 45496
mergestate: initialize all properties in __init__()
This is hopefully not very controverial. I found the initialization
before this patch unorthodox. It wasn't clear which properties the
object was supposed to have.
Differential Revision: https://phab.mercurial-scm.org/D9037
Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Sep 2020 19:33:55 -0700] rev 45495
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 45494
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 45493
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 45492
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 45491
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 45490
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 45489
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
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 03 Sep 2020 13:25:29 +0530] rev 45488
merge: move initial handling of mergeactions near to later one
We build `mergeactions` in the beginning and use it in end. Let's build it just
before where it will be used. Helps making code much easier to understand.
Differential Revision: https://phab.mercurial-scm.org/D8983
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 25 Jun 2020 13:16:55 +0530] rev 45487
upgrade: support running upgrade if repository has share-safe requirement
This helps us in testing changing requirements of source repository and checking
that the shared repository works.
Differential Revision: https://phab.mercurial-scm.org/D8660
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 17 Sep 2020 18:49:57 -0700] rev 45486
config: add `--shared` flag to edit config file of shared source
With `format.exp-share-safe` enabled, we now read the `.hg/hgrc` of the shared
source also.
This patch adds `--shared` flag to `hg config` command which can be used to edit
that shared source config file. It only works if the repository is shared one
and is shared using the safe method.
Differential Revision: https://phab.mercurial-scm.org/D8659
Pulkit Goyal <7895pulkit@gmail.com> [Thu, 02 Jul 2020 16:23:36 +0530] rev 45485
localrepo: load the share source .hg/hgrc also in share-safe mode (API)
The second part of the Share Safe Plan is to share source repo config also.
This patch adds logic to load the source repo .hg/hgrc if we are in share safe
mode. On unshare, we copy and prepend source config to current repo so that
config which was shared is persisted.
A test is added to show that now if we enable a hook on the source repo, that
also runs on the shared repositories.
API change as a new optional argument sharedvfs added to localrepo.loadhgrc()
Differential Revision: https://phab.mercurial-scm.org/D8656
Pulkit Goyal <7895pulkit@gmail.com> [Fri, 07 Aug 2020 17:42:15 +0530] rev 45484
helptext: document exp-sharesafe in internals/requirements.txt
`exp-sharesafe` is a new requirement and we should document it.
Differential Revision: https://phab.mercurial-scm.org/D8914
Pulkit Goyal <7895pulkit@gmail.com> [Tue, 14 Apr 2020 21:07:09 +0530] rev 45483
share: introduce config option to store requires in .hg/store
This introduces a config option which enabled stores the requirements on a
repository in store instead.
When enabled, `.hg/requires` will contain the `share-safe` requirement which
marks that the requirements are present in the store.
This is done so that repository requirements can be shared with shares made
using `hg share` command.
After this patch, `hg share` checks whether the source repository has
share-safe requirement, if yes, it does not copy the requirements.
Test for the new functionality is added and a test case in exitsing share tests
is also added.
Differential Revision: https://phab.mercurial-scm.org/D8633