Commit Graph

151 Commits

Author SHA1 Message Date
Pierre-Yves David
0e8c77f94c push: check if local and remote support evolution during discovery
We can now directly prevent any evolution-related operation from happening by using
an empty set for outgoing markers. So we detect if no transfers should occur and
use an empty set in this case.
2014-08-20 17:36:54 -07:00
Pierre-Yves David
89e39a0c90 exchange: remove duplicated addition to pushop.stepdone
Not sure how it got there but it is useless.
2014-08-15 19:18:21 -07:00
Augie Fackler
ab198a5534 exchange: drop superfluous parens 2014-08-18 20:23:37 -04:00
Pierre-Yves David
a047d46203 push: add bookmarks to the unified bundle2 push
We use the `pushkey` part to exchange bookmark updates within the unified
bundle2 push. Note that this only applies on update (moving a bookmark known on both
sides) since bookmark export (creation of a new bookmark on remote) is apparently
done outside of the _push function.
2014-08-15 19:03:42 -07:00
Pierre-Yves David
698a1a6825 push: use stepsdone to control bookmark push
If bookmark are to be integrated in the unified bundle2, we need a way to disable
the old-style push.
2014-08-15 18:40:57 -07:00
Pierre-Yves David
f2ec8aebea push: move bookmark discovery with other discovery steps
The discovery of necessary bookmark updates is now done within the "discovery
phase". This opens the door to the inclusion of bookmarks in a unified bundle2
push.
2014-08-15 18:39:39 -07:00
Pierre-Yves David
1840ea298f pushbookmark: split an ultra-long line into a saner version
We make a temporary variable for the remote bookmark data and we do not expand
all elements from `bookmark.compare` since we are going to use only one.
2014-08-15 18:02:54 -07:00
Pierre-Yves David
c881935cf8 pushbookmark: do not attempt to update bookmarks if the push failed (BC)
Before this patch, there was always an attempt to update bookmark even if prior
steps of the push failed. I cannot see a good semantic reason to do so. We
disable this possibility to simplify the push flow with bundle2. Bookmarks will
be included in the bundle and fail with other steps.
2014-08-15 18:26:21 -07:00
Pierre-Yves David
a6180e3cd6 pushbookmark: remove a <cond> and <val> or <other> construct
We make the conditional explicit for the sake of readability.
2014-08-15 17:58:15 -07:00
Pierre-Yves David
3727918ac1 pushbookmark: stop unrolling ancestors
Now that ancestors has the same boolean property as a list, we can stop unrolling
the set of ancestors. This should provide a significant speedup to this step as
ancestor objects are smart and lazy.
2014-08-15 16:31:06 -07:00
Pierre-Yves David
45e2e4b993 push: update bookmarks within the remote lock
Updating bookmarks is part of the push. It should be done within the same lock
as the other steps of the push.
2014-08-15 15:25:12 -07:00
Pierre-Yves David
a9275323db phase: add a transaction argument to advanceboundary
We now pass a transaction option to this phase movement function. The object
is currently not used by the function, but it will be in the future.

All call sites have been updated. Most call sites were already enclosed in a
transaction for a long time. The handful of others have been recently
updated in previous commit.

The retractboundary function remains to be upgraded.
2014-08-06 01:54:19 -07:00
Pierre-Yves David
aaed9a0813 pull: pre-filter remote phases before moving local ones
We were relying on the phase internals to filter out redundant phase
information from remove. However as we plan to integrate phase
movement inside the transaction, we want to avoid useless transaction
creation on no-op pulls.

Therefore we filter out all the information that already matches the current
repository state. This will let us create a transaction only when there is
actual phase movement needed.
2014-08-06 00:54:37 -07:00
Matt Mackall
7cba48bf37 whitespace: nuke triple blank lines in **.py 2014-08-07 14:58:12 -05:00
Pierre-Yves David
322ec1b757 push: wrap local phase movement in a transaction
Phases are not yet inside the transaction, but we need to prepare for it. So we
wrap the phase movement inside a transaction.
2014-08-06 00:54:15 -07:00
Pierre-Yves David
cc9f66eab2 push: use stepsdone for obsmarkers push
We do not have infrastructure to include obsolescence markers in the bundle2
push from core. But extensions may so we make sure it would not be sent twice.
2014-07-31 13:51:17 -07:00
Pierre-Yves David
8ac50232a0 push: introduce a discovery step for obsmarker
The discovery step is still not doing anything smart. But this will allow
extension to wrap it.
2014-07-05 19:32:20 +02:00
Pierre-Yves David
1a0b1222c5 push: move the list of obsmarker to push into the push operation
The list is now carried in the push operation, this will let
extensions override it.
2014-07-05 19:17:09 +02:00
Pierre-Yves David
c3d4f292a8 push: explicitly encode a list of obsmarkers to push
Sending obsmarkers through pushkey requires extra encoding (since pushkey can't
take binary content) and slicing (since we can hit http header limit). As we
send all obsolescences markers that exists in the repo for each push, we used to
just look at the content of the "obsolete" pushkey namespace (already encoded
and sliced) and send its
content.

However, future changeset will make it possible to push only parts of the
obsmarkers. To prepare this we now explicitly encode a list of markers. The list
of markers is still "all of them" but future changeset will takes care
of that.

The new code uses a "_protected" method but that seems reasonable to keep it
private as this is the is the only external user of it and this whole pushing
obsmarker through pushkey things in fairly hacky already)
2014-07-04 19:31:49 +02:00
Pierre-Yves David
4d68940dba push: include phase push in the unified bundle2 push
Phase push is now included in the same bundle2 push as changesets. We use
multiple pushkey parts to transmit the information. Note that phase moves are
still not part of the repository "transaction".
2014-07-01 23:08:17 +02:00
Pierre-Yves David
bee675a073 push: perform phases discovery before the push
This will allow including phase information in the same bundle2 as the
changesets.
2014-07-30 19:26:47 -07:00
Pierre-Yves David
ce9f85e2a8 push: make discovery extensible
We need to gather all discovery before the unified bundle2 push. We
use the same pattern as bundle2 parts generation.
2014-07-01 17:06:02 +02:00
Pierre-Yves David
421f86b4d6 push: rework the bundle2partsgenerators logic
Instead of a single list of functions, we now have a list of names and
a mapping of names to functions. This simplifies wrapping of steps
from extensions. In the same move, declaration becomes decorator-based
(syntax sugar, nom nom nom!).
2014-07-30 19:04:50 -07:00
Pierre-Yves David
77a2e846ed push: move common heads computation into pushop
Now that both options (push succeed or fall back) live in pushop, we
can move the common heads computation there too. It is a very commonly
accessed attribute so it makes a lot of sense to have it in pushop.
2014-07-01 17:27:22 +02:00
Pierre-Yves David
95a8ba3038 push: extract fallback heads computation into pushop
Similar motivation to `futureheads`, we extract the computation into pushop
to make it available early to all possibly interested parties.
2014-07-01 17:20:47 +02:00
Pierre-Yves David
b3209a1336 push: extract future heads computation into pushop
Bundle2 will allow pushing all different parts of the push in a single bundle.
This mean that the discovery for each part needs to be done before trying to
push. Currently we may have different behaviors for phases and obsolescence markers
when the push of changesets fails. For example, information may still be
exchanged for a part of the history where changesets are common but where
phases mismatch. So the preparation of the push need to determine what
information need to be pushed in both situations. And it needs a different set of
heads for this. Therefore we are moving heads computation within pushop for easy
access by all parties. We start with the simplest set of heads.
2014-07-01 17:20:31 +02:00
Pierre-Yves David
3d5f179a17 getbundle: add a `cg` boolean argument to control changegroup inclusion
The ``getbundle`` function was initially design to return a changegroup bundle.
However, bundle2 allows transmitting a wide range of data. Some bundle2
requests may not include a changegroup at all.

Before this changeset, the client would request a changegroup for
``heads=[nullid]`` and receive an empty changegroup.

We introduce an official boolean parameter, ``cg``, that can be set
to false to disable changegroup generation on getbundle. A new bundle2
capability is introduced to let the client know.
2014-05-31 16:48:29 -07:00
Pierre-Yves David
4ab165af6a bundle2: only use callable return as reply handler
When a bundle2 parts generator returns a non callable value, it should not be
used as a reply handler. The changegroup part generator is already having this
case of behavior when there is no changegroup to push. This changeset prevent a
crash for user of the experimentable bundle2 feature.
2014-07-02 16:13:48 +02:00
Pierre-Yves David
c58559c32a bundle2-push: drop _pushbundle2extraparts
All core user are now using the new way. We drop the old way.
2014-07-02 15:47:39 +02:00
Pierre-Yves David
1df43f3299 bundle2-push: introduce a list of part generating functions
Instead of explicitly calling a few function to generate part in the bundle, we
now have a list of all part generators. This should make it easier for
extensions to adds new part in the bundle.

This new way to extend the push deprecates the old `_pushbundle2extraparts` way.
2014-07-02 15:26:04 +02:00
Pierre-Yves David
2418b3778f bundle2-push: move changegroup push validation inside _pushb2ctx
When bundle2 push includes more than just changesets, we may have no
changegroup to push yet still have other data to push.

So we now try to performs a bundle2 push in all cases. The check for changegroup
inclusion is moved into the ``_pushb2ctx`` function in charge of creating the
changegroup part.

The bundle2 part is aborted if no actual payload part have been added to the
bundle2.
2014-07-02 12:55:09 +02:00
Pierre-Yves David
9163633b35 push: use stepsdone to control changegroup push through bundle10 or bundle20
We use the newly introduced `pushop.stepsdone` attribute to inform
older methods than changegroup have already been pushed using a newer
method.
2014-07-07 12:30:31 +02:00
Pierre-Yves David
0b263a85d2 push: add a `pushop.stepsdone` attribute
This attribute will record what steps were performed during the bundle2 push.
This will control whenever the old way push must be performed or skipped. This
will ultimately be used by changegroup, phases, obsmarkers, bookmarks and any
other kind of data ones may want to exchange even when bundle2 support is
missing.
2014-07-02 12:48:54 +02:00
Pierre-Yves David
5403bb5287 bundle2-push: extract changegroup logic in its own function
We extract the creation of changegroup related parts into its own function.
This precludes the inclusion of more diverse data during the bundle2 push.

We use a closure to carry the logic that need to be perform when processing the
server reply.
2014-07-02 11:42:35 +02:00
Pierre-Yves David
3c5524525e bundle2: call _pushbundle2extraparts a bit sooner
This is the first step of a refactoring that will ease the inclusion of new part
in the bundle2 push and includes more information (like phases) in this push

We need to move the function a bit sooner to be able to group the generation of
`b2x:check:heads` and `b2x:changegroup` part in an external function. We move it
sooner to preserve parts creation order bundle2 tests rely on. At the ends of this
refactoring the `_pushbundle2extraparts` will be replaced by another mechanism
anyway.
2014-07-02 14:09:24 +02:00
Matt Mackall
f3b0b8e4bb merge with stable 2014-06-18 20:59:36 -05:00
Matt Mackall
831df5027c push: restore contents of HG_URL for hooks (issue4268) 2014-06-18 19:46:18 -05:00
Durham Goode
e18e8b3005 bundle2: fix bundle2 pulling all revs on empty pulls
When bundle2 was enabled, if hg pull had no commits to pull, it would print
'no changes found' and then download the entire repository from the server. This
was caused by heads and common being set to None, which gets treated as
heads=cl.heads() and common=[nullid], which means download the entire repo.

Pulling bundles without a changegroup is a valid use case (like if we're just
updating bookmarks), so this modifes the bundle code to allow not adding
changegroups.

This is backport of 26ad3517a3a2.
2014-05-07 17:24:19 -07:00
Pierre-Yves David
d55202b92c exchange: fix bad indentation
Those two lines where double indented for no good reasons.

This is backport of d889859ccef0.
2014-05-07 19:26:15 -07:00
Pierre-Yves David
d4684c05ab exchange: propagate arguments to the _getbundleextrapart function
The arguments was wrongly propagated (again).

This a backport of 1c1da5990b8c
2014-05-07 19:28:17 -07:00
Durham Goode
f8ebc64925 bundle2: fix configuration name mismatch
During pulls bundle2 was checking server.bundle2, but during pushes it was
checking experimental.bundle2. This makes them both experimental.bundle2.

This is a backport of a9334b37b19a
2014-05-07 17:20:38 -07:00
Yuya Nishihara
621a878ba5 exchange: fix invalid reference to bundle2.UnknownPartError caught by pyflakes 2014-04-29 12:35:02 +09:00
Pierre-Yves David
cb0ccbf8af bundle2: gracefully handle hook abort
We make sure any exceptions raised during the whole span of handling bundle2
processing are decorated. This let us catch exceptions raised by hooks prior to
transaction commit.
2014-04-21 16:13:15 -07:00
Pierre-Yves David
716843e5d3 bundle2: fix raising errors during heads checking
If the heads on the server differ from the ones reported seen by the client at
bundle time, we raise a PushRaced exception. However, the part raising the
exception was broken.

To fix it, we move the PushRaced class in the error module so it can be
accessible everywhere without an import cycle.

A test is also added to prevent regression.
2014-04-21 18:59:09 -07:00
Pierre-Yves David
d27dff342a bundle2: catch UnknownPartError during local push
When doing local push, UnknownPartError from the server will be raised directly
to the client. We need to catch them too.
2014-04-22 11:41:34 -07:00
Pierre-Yves David
7eb6e3f27d bundle2: catch UnknownPartError during pull
We narrow the exception catching while pulling.
2014-04-21 19:43:01 -07:00
Pierre-Yves David
dc21483bc8 bundle2: catch UnknownPartError during push
We narrow the exception catching while unbundling the push reply.
2014-04-21 19:42:51 -07:00
Pierre-Yves David
f63734b94b bundle2: allow extensions to extend the getbundle request
We want extensions to be able to request extra parts.
2014-04-17 16:56:15 -04:00
Pierre-Yves David
bc1c360f82 bundle2: add a way to add parts during a getbundle request
We add a hook function to let extensions add parts to the bundle.
2014-04-17 17:32:34 -04:00
Pierre-Yves David
9761757d1d getbundle: pass arbitrary arguments all along the call chain
The wireprotocol command accepts arbitrary arguments, we are now passing such
arguments down the call chain.
2014-04-17 17:25:50 -04:00