Martin von Zweigbergk <martinvonz@google.com> [Thu, 29 Mar 2018 22:51:45 -0700] rev 37174
context: move reuse of context object to repo.__getitem__ (API)
As an example of how weird the basectx.__new__ is: whenever you create
a workingctx, basectx.__new__ gets called first. Since our __new__ has
a "changeid" argument as second parameter, when create the
workingctx(repo, text="blah"), the text gets bound to
"changeid". Since a string isn't a basectx, our __new__ ends up not
doing anything funny, but that's still very confusing code.
Another case is metadataonlyctx.__new__(), which I think exists in
order to prevent metadataonlyctx.__init__'s third argument
(originalctx) from being interpreted as a changeid in
basectx.__new__(), thereby getting reused.
Let's move this to repo.__getitem__ instead, where it will be pretty
obvious what the code does.
After this patch, changectx(ctx) will be an error (it will fail when
trying to see if it's a 20-byte string).
Differential Revision: https://phab.mercurial-scm.org/D2969
Martin von Zweigbergk <martinvonz@google.com> [Thu, 29 Mar 2018 22:22:51 -0700] rev 37173
memctx: create parent contexts using "repo[p]" syntax
I want to reduce dependence on basectx.__new__() and move that code
over to repo.__getitem__().
Differential Revision: https://phab.mercurial-scm.org/D2968
Martin von Zweigbergk <martinvonz@google.com> [Thu, 29 Mar 2018 21:29:15 -0700] rev 37172
context: avoid using a context object as a changeid
I find it misleading to pass changeid=changectx. It currently works to
do that because there's weird (IMO) handling of it in
basectx.__new__. I'm planning on removing that code. Passing changeid
as "changeid" and context as "context" makes it more readable.
Note that the documentation of filectx.__init__ doesn't even seem to
be aware that a changeid can be a context ("changeset revision, node,
or tag").
Differential Revision: https://phab.mercurial-scm.org/D2967
Martin von Zweigbergk <martinvonz@google.com> [Thu, 29 Mar 2018 21:15:40 -0700] rev 37171
context: remove unwanted assignments in basectx.__new__() (API)
The two subclasses in core apparently didn't trust __new__() to do the
job anyway (they both reassigned all the properties after).
Differential Revision: https://phab.mercurial-scm.org/D2966
Boris Feld <boris.feld@octobus.net> [Wed, 31 Jan 2018 17:15:44 +0100] rev 37170
streamclonebundle: make sure we accept new stream clone bundle spec
When asked specifically, the code do a sanity check on the clone bundle to
ensure it's a stream bundle. As we introduced a new stream bundle spec, update
the logic to support it.
With this final changeset, we can now announce safely a stream v2 clone bundle
and old clients would not crash trying to process it.
This changeset address the last comment from Gregory Szorc on the stream v2
bundle series.
Differential Revision: https://phab.mercurial-scm.org/D1957
Boris Feld <boris.feld@octobus.net> [Wed, 31 Jan 2018 11:44:33 +0100] rev 37169
streamclonebundle: add a test for stream clone bundle v2
Differential Revision: https://phab.mercurial-scm.org/D1956
Boris Feld <boris.feld@octobus.net> [Wed, 31 Jan 2018 11:10:55 +0100] rev 37168
bundlespec: add support for some variants
This way the stream v2 bundle spec can disable the changegroup part while
enabling the stream v2 part.
Differential Revision: https://phab.mercurial-scm.org/D1955
Boris Feld <boris.feld@octobus.net> [Wed, 31 Jan 2018 11:09:20 +0100] rev 37167
bundle: add the possibility to bundle a stream v2 part
Differential Revision: https://phab.mercurial-scm.org/D1954