Commit Graph

96 Commits

Author SHA1 Message Date
Pierre-Yves David
8ab4eab6ab push: pass a pushoperation object to localrepo.checkpush
The `pushoperation` object contains strictly more data the arguments currently
passed to `localrepo.checkpush` we pass the new object instead. This function is
used by MQ to abort push that includes MQ changesets.

Note: extension that may use this function will have to align.
2014-04-01 13:45:48 -07:00
Pierre-Yves David
4d69095b80 pull: add a set of steps that remain to be done during the pull
With bundle2 we'll slowly move current steps into a single bundle2 building and
call (changegroup, phases, obsmarkers, bookmarks). But we need to keep the
old methods around for servers that do not support bundle2. So we introduce
this set of steps that remains to be done.
2014-04-01 18:56:19 -07:00
Pierre-Yves David
82aa43720e pull: put discovery step in its own function
The discovery is a full step that will grow to contain more than changesets. We
set it in its own function like all other steps.
2014-04-01 17:35:25 -07:00
Pierre-Yves David
98252a796e pull: move the cgresult logic in _pullchangeset
Logical follow up of the previous changeset. The `_pullchangeset` is now
responsible of setting the `pullop.cgresult`.
2014-04-01 17:28:21 -07:00
Pierre-Yves David
c681ad99b9 pull: move return code in the pull operation object
With bundle2 we'll have multiple code path susceptible to be responsible for
adding changeset during the pull. We move it to the pull operation to simplify
this the coming logic. The one doing the adding the changegroup will set the
value.
2014-04-01 17:21:52 -07:00
Pierre-Yves David
a4638e445b pull: prevent duplicated entry in op.pulledsubset
In the bare pull case we could add the same node multiple time to the
`pulloperation.pulledsubset`. Beside being a bit wrong this confused the new
revset implementation of `revset._revancestor` into giving bad result.

This changeset fix the pull operation part. The fix for the revset itself will
come in another changeset.
2014-03-26 15:55:32 -07:00
Siddharth Agarwal
fdc2cd7e0e exchange: fix docs for pulloperation
'remote' is actually the remote, not the repo one is pulling into. This
confused me quite a bit.
2014-02-27 19:56:36 -08:00
Pierre-Yves David
3f17a93498 pull: move changeset pulling in its own function
pull: move changeset pulling in its own function

Now that every necessary information is held in the `pulloperation` object, we
can finally extract the changeset pulling to it's own function.

This changeset is pure code movement only.
2014-01-31 01:39:59 -08:00
Pierre-Yves David
9f09184d30 pull: move fetch subset into the object
Tree discovey use a `fetch` variable to know what is being pulled. We move this
information in the `pulloperation` object. This make it possible to extract the
changeset pulling logic into its own function.
2014-02-11 14:51:38 -08:00
Pierre-Yves David
af185d32f5 pull: make pulled subset a propertycache of the pull object
The computation of the subset is simple operation using two useful pull
information (1) the set of common changeset before the pull (2) the set of
pulled changeset. We move this data into the `pulloperation` object since some
phase will need them. And we turn the pulled subset computation behind a
property case as multiple pull phase will need it.
2014-01-31 01:34:00 -08:00
Pierre-Yves David
ad09bf1d2b pull: move phases synchronisation in its own function
Now that every necessary information is held in the `pulloperation` object, we
can finally extract the phase synchronisation phase to it's own function.

This changeset is pure code movement only.
2014-01-31 01:25:56 -08:00
Pierre-Yves David
542abb260f pull: move pulled subset into the object
We compute the set of local changeset that were target of the pull. This is then
used by phases logic to decide which part of the history should have it phase
updated.

We move this information into the object to allow extraction of phase
synchronisation in its own function.

I expect obsolete marker exchange to use it too in the future.
2014-01-31 01:21:42 -08:00
Pierre-Yves David
9e5b5327f1 push: feed pulloperation object to _pullobsolete function
We now have all necessary information in the `pulloperation` object itself.
2014-01-31 01:12:35 -08:00
Pierre-Yves David
f0ae9ab368 pull: move transaction logic into the pull object
Most local change that occurs during a pull are doing within a `transaction`.
Currently this mean (1) adding new changeset (2) adding obsolescence markers. We
want the two operations to be done in the same transaction. However we do not
want to create a transaction if nothing is added to the repo. Creating an empty
transaction would drop the previous transaction data and confuse tool and people
who are still using rollback.

So the current pull code has some logic to create and handle this transaction on
demand. We are moving this logic in to the `pulloperation` object itself to
simplify this lazy creation logic through all different par of the push.

Note that, in the future, other part of pull (phases, bookmark) will probably
want to be part of the transaction too.
2014-01-31 01:04:05 -08:00
Pierre-Yves David
33b568da08 pull: move obsolescence marker exchange in the exchange module
The obsolescence marker exchange code was already extracted during a previous
cycle. We are moving the extracted functio in this module. This function will
read and write data in the `pulloperation` object and I prefer to have all core
function collaborating through this object in the same place.

This changeset is pure code movement only. Code change for direct consumption of
the `pulloperation` object will come later.
2014-01-30 17:38:41 -08:00
Pierre-Yves David
b3035d77ba pull: move force argument into pull object
One more step toward a more modular pulh function.
2014-02-01 03:49:29 -08:00
Pierre-Yves David
f36dde4c52 pull: move heads argument into pull object
One more step toward a more modular pull function.
2014-01-30 17:35:55 -08:00
Pierre-Yves David
586b7945da pull: move remote argument into pull object
One more step toward a more modular pull function.
2014-01-30 17:32:04 -08:00
Pierre-Yves David
9191d202bb pull: introduce a pulloperation object
This object will hold all data and state gathered through the pull. This will
allow us to split the long function into multiple small one. Smaller function
will be easier to maintains and wrap.  The idea is to blindly store all
information related to the pull in this object so that each step and extension
can use them if necessary.

We start by putting the `repo` variable in the object. More migration in other
function.
2014-01-30 17:24:49 -08:00
Pierre-Yves David
790a805eac exchange: extract pull function from localrepo
The localrepo class if far too big. Push and pull logic are extracted and
reworked to better fit with the fact we exchange more than bundle now.

This changeset extract the pulh code. later changeset will slowly slice it into
smaller brick.

The localrepo.pull method is kept for now to limit impact on user code. But it
will be ultimately removed, now that the public API is hold by peer.
2014-01-30 16:12:49 -08:00
Pierre-Yves David
19dbca86d4 push: extract new common set computation from phase synchronisation
Now that every necessary information is held in the `pushoperation` object, we
can extract the new common set computation to it's own function.

This changeset is pure code movement only.
2014-01-30 23:12:03 -08:00
Pierre-Yves David
00a8d606ca push: move commonheads into the push object
The phase synchronisation start by computing the new set of common head between
local and remote and then do the phase synchronisation on this set. This new
common set logic will eventually be used by the obsolescence markers exchange.
So we are going to split the long phase synchronisation in two.
2014-01-30 23:16:43 -08:00
Pierre-Yves David
54bbace959 push: move discovery in its own function
Now that every necessary information is held in the `pushoperation` object, we
can extract the discovery logic to it's own function.

This changeset is pure code movement only.
2014-01-30 21:05:29 -08:00
Pierre-Yves David
9e52053ef7 push: move outgoing check logic in its own function
Now that every necessary information is held in the `pushoperation` object, we
can extract the part responsible of aborting the push to it's own function.

This changeset is mostly pure code movement. the exception is the fact this
function returns a value to decide if changeset bundle should be pushed.
2014-01-30 21:01:21 -08:00
Pierre-Yves David
6d2b03f7d5 push: move incoming into the push object
The fact that there is some unknown changes on remote one of the result of
discovery. It is then used by some push validation logic.

We move it in the object to be able to extract the said logic.
2014-01-30 21:01:13 -08:00
Pierre-Yves David
a2cf760f9e push: move changeset push logic in its own function
Now that every necessary information is held in the `pushoperation` object, we
can extract the logic pushing changeset  to it's own function.

This changeset is pure code movement only.
2014-01-30 20:44:55 -08:00
Pierre-Yves David
e83b253ec0 push: move remoteheads into the push object
The heads of the remote repository are used to detect race when pushing
changeset. We now store this information in `pushoperation` object  to allow
extraction of the changeset pushing part.
2014-01-30 20:34:35 -08:00
Pierre-Yves David
48473f3287 push: move phases synchronisation function in its own function
Now that every necessary information is held in the `pushoperation` object, we
can finally extract the phase synchronisation phase to it's own function. This
is the first concrete block of code we extract from the huge push function.
Hooray!

This changeset is pure code movement only.
2014-01-30 20:22:43 -08:00
Pierre-Yves David
a17a66f49e push: move outgoing object in the push object
The set of outgoing and common changeset are used by phases to compute the new
common set between local and remote. So we need to move it into the object to
extract the phase sync from the god function.

Note that this information will be used by obsolescence markers too.
2014-01-30 20:18:26 -08:00
Pierre-Yves David
d37c15cc69 push: move push return value in the push object
The return code convey information about the success of changeset push. This is
used by phases to compute the new common set between local and remote. So we
need to move it into the object to extract the phase sync from the god
function.

Note that this information will be used by obsolescence markers too.
2014-01-30 19:43:28 -08:00
Pierre-Yves David
01ce069d96 push: move local phase move in a normal function
We now have the modularity for simpler approach `localphasemove`.
2014-01-30 20:10:59 -08:00
Pierre-Yves David
cad91f44e1 push: explicitly feed pushop to localphasemove
Now that pushop is holding all the push related data, we do not really need a
closure anymore. So we start feeding the object to `localphasemove` and will
make it a normal function in the next commit.
2014-01-30 20:09:21 -08:00
Pierre-Yves David
229e0e4cb0 push: move local lock logic in pushoperation
During push, we try to lock the local repo to move local phase according to what
we saw/pushed on the remote repo. Locking the repo may fail, in that case we let
the push proceed without local phase movement (printing warning).

This mean we have code in phase synchronisation that will check if the local repo is
locked or not. we need to move this information in the push object to be able to
extract the phase synchronisation in its own function. This is done as a boolean
because putting reference to the actual lock outside of the main function
sounded a bad idea.
2014-01-30 20:00:34 -08:00
Pierre-Yves David
018f4f94d4 push: move obsolescence related message into _pushobsolescence function
No good reason to have them in the main fonction.
2014-01-30 19:55:09 -08:00
Pierre-Yves David
fdca8c570d push: drop now outdated comment
This `_pushobsolete` now exist for modularity purpose.
2014-01-30 19:51:21 -08:00
Pierre-Yves David
0259725b46 push: feed pushoperation object to _pushobsolete function
This will allow the obsolete marker synchronisation to have full
information on the ongoing push and pass information to other
operation.
2014-01-30 17:56:09 -08:00
Pierre-Yves David
97a8524afb push: move obsolescence marker exchange in the exchange module
The obsolescence marker exchange code was already extracted during a previous
cycle. We are moving the extracted functio in this module. This function will
read and write data in the `pushoperation` object and I prefer to have all core
function collaborating through this object in the same place.

This changeset is pure code movement only. Code change for direct consumption of
the `pushoperation` object will come later.
2014-01-30 17:54:47 -08:00
Pierre-Yves David
d2cbf08f57 push: feed pushoperation object to _pushbookmark function
This will able the bookmark synchronisation to have full information on the
ongoing push and pass information to other operation.
2014-01-30 17:51:41 -08:00
Pierre-Yves David
971cefa104 push: move bookmarks exchange in the exchange module
The bookmark exchange code was already extracted during a previous cycle. This
changesets moves the extracted function in this module. This function will read
and write data in the `pushoperation` object and It  is preferable to have all
core function collaborating through this object in the same place.

This changeset is pure code movement only. Code change for direct consumption of
the `pushoperation` object will come later.
2014-01-30 17:46:51 -08:00
Pierre-Yves David
49e928ef6b push: move newbranch argument into the push object
One more step toward a more modular push function.
2014-01-30 17:08:29 -08:00
Pierre-Yves David
579d48c27b push: move revs argument into the push object
One more step toward a more modular push function.
2014-01-30 17:04:23 -08:00
Pierre-Yves David
99860f7215 push: move force argument into the push object
One more step toward a more modular push function.
2014-01-30 16:59:25 -08:00
Pierre-Yves David
ab2b4d5db8 push: move remote argument in the push object
One more step toward a more modular push function.
2014-01-30 16:57:01 -08:00
Pierre-Yves David
97abb80300 push: ease access to current ui object
The `pushoperation.repo.ui` attribute is very commonly used. we offer a faster way
to access it directly through the push operation object.
2014-01-30 16:46:30 -08:00
Pierre-Yves David
836dd3b929 push: introduce a pushoperation object
This object will hold all data and state gathered through the push. This will
allow us to split the long function into multiple small one. Smaller function
will be easier to maintains and wrap.  The idea is to blindly store all
information related to the push in this object so that each step and extension
can use them if necessary.

We start by putting the `repo` variable in the object. More migration in other
changeset.
2014-01-30 16:43:11 -08:00
Pierre-Yves David
f35f0a3cb0 exchange: extract push function from localrepo
The localrepo class if far too big. Push and pull logic will be extracted and
reworked to better fit with the fact they now exchange more than plain changeset
bundle.

This changeset extract the push code. later changeset will slowly slice this
over 200 hundred lines and 8 indentation level function into smaller saner
brick.

The localrepo.push method is kept for now to limit impact on user code. But it
will be ultimately removed, now that the public supposed API is hold by peer.
2014-01-30 15:34:01 -08:00