Commit Graph

40 Commits

Author SHA1 Message Date
Pierre-Yves David
cfe00fb313 ssh: capture output with bundle2 again (issue4642)
I just discovered that we are not displaying ssh server output in real time
anymore. So we can just fall back to the bundle2 output capture for now. This
fix the race condition issue we where seeing in tests. Re-instating real time
output for ssh would fix the issue too but lets get the test to pass first.
2015-05-18 22:35:27 -05:00
Pierre-Yves David
e5b26a2e94 bundle2: disable ouput capture unless we use http (issue4613 issue4615)
The current bundle2 processing was capturing all output. This is nice as it
provide better meta data about what output what, but this was changing two
things:

1) adding a prefix "remote: " to "other" output during local push (issue4613)
2) local and ssh push does not provide real time output anymore (issue4615)

As we are unsure about what form should be used in (1) and how to solve (2) we
disable output capture in this two cases. Output capture can be forced using an
experimental option.
2015-04-28 17:38:02 -07:00
Matt Harbison
a3c34e558c test-bundle2-exchange: make hooks compatible with Windows
The cmd.exe process doesn't fail the hook when "; false" is appended, and its
echo command prints out the quote characters.
2015-04-26 15:10:09 -04:00
Pierre-Yves David
1dc90191f8 bundle2: also save output when error happens during part processing
Until this changeset, we were only able to save output if an error happened
during the 'transaction.close()' phase. If the 'processbundle' call raised an
exception, the 'bundleoperation' object was never returned, so the reply bundle
was never accessible and no output could be salvaged. We introduce a quick (but
not very elegant) fix to gain access to any reply created during the processing.

This conclude this output related series. We should hopefully be able client-side to see the
whole server output, in a proper order.

The code is now complex enough that a refactoring of it would make sense on
default.
2015-04-23 16:36:18 +01:00
Pierre-Yves David
ae773fc61e bundle2: capture output issue during transaction close
We were capturing all output issue during bundle2 processing, and all output
issue during transaction rollback in case of failure. However, the output issue
during transaction commit was still roaming the land freely. It is now put back
in line.

This let the user see output from 'pretxnclose' and 'txnclose' (and related) in
the right order.
2015-04-23 14:54:45 +01:00
Pierre-Yves David
1e8ec29191 bundle2: also capture hook output during processing
External hook used to directly write on stdout and stderr. As a result their
output was not captured by the bundle2 processing. This resulted in confusing
out of order output on the client side. We are now capturing hooks output in
this context.
2015-04-23 17:03:58 +01:00
Pierre-Yves David
47985fc815 bundle2: capture transaction rollback message output (issue4614)
The output from the transaction rollback was not included into the reply bundle.
It was eventually caught by the usual 'unbundle' output capture and sent to the
client but the result was out of order on the client side. We now capture the
output for the transaction release and transmit it the same way as all other
output.

We should probably rethink the whole output capture things but this would not be
appropriate for stable.

The is still multiple cases were output failed to be properly capture, they will
be fixed in later changesets.
2015-04-23 14:20:36 +01:00
Pierre-Yves David
bf28a4a61f changelog: fix readpending if no pending data exist (issue4609)
Since transaction are used for more than just changesets, it is possible
to have a transaction without new changesets at all. In this case no
''00changelog.i.a' are written. In all cases the 'changelog.readpending'
method is called if the repository has any pending data. The 'revlog' logic
provides empty content if the file is missing, so the whole operation
resulted in an empty changelog.

We now skip reading the pending file if it is missing.
2015-04-20 17:16:22 +02:00
Pierre-Yves David
fe42feb68e bundle2-localpeer: properly propagate the server output on error (issue4594)
In case of errors, output parts salvaged from the reply bundle need to be
processed for outputting their content. This concludes our quest for fixing
issue4594.
2015-04-16 04:01:51 -04:00
Pierre-Yves David
0bbcf25859 bundle2-wireproto: properly propagate the server output on error (issue4594)
In case of errors, output parts salvaged from the reply bundle are re-injected
into the bundle carrying the exception.

We still need to fix the situation for non-wireprotocol push.
2015-04-16 03:17:37 -04:00
Pierre-Yves David
b13ab55f2f unbundle: acquire 'wlock' when processing bundle2 (BC) (issue4596)
A bundle2 may contain bookmark updates (or other extension content) that
requires the 'wlock' to be written. As 'wlock' must be acquired before 'lock',
we must stay on the side of caution and use both in all case to ensure their
ordering.
2015-04-15 01:16:40 -04:00
Pierre-Yves David
93e144e4f3 run-test: enable the devel warning during tests
This should help us to catch new locking order issues as soon as possible.

There are two harmless test updates (from the config change). Moreover, some
bundle2 tests are displaying warning for a legitimate reason. The use of pushkey
during the unbundle process may requires the 'wlock' after 'lock' (around the
whole unbundle process was taken). This is non-trivial to fix, so I better have
the check on, with the warning in the test than the check off. See issue4596 for
details.
2015-04-12 09:46:03 -04:00
Pierre-Yves David
502fe91f02 transaction: introduce a transaction ID, to be available to all hooks
The transaction ID is built from the object ID and creation time stamp to make
sure it is unique.
2015-04-15 11:11:54 -04:00
Pierre-Yves David
d9bafadc4d bundle2: use unbundle source as transaction name
This is what a bundle 1 push is doing. This got caught by trying to run the
whole test-suite using bundle2 for exchanges.
2015-04-11 13:58:36 -04:00
Pierre-Yves David
af7d20b000 bundle2: rename format, parts and config to final names
It is finally time to freeze the bundle2 format! To do so we:
- rename HG2Y to HG20,
- drop "b2x:" prefix from all part names,
- rename capability to "bundle2-exp" to "bundle2"
- rename the hook flag from 'bundle2-exp' to 'bundle2'
2015-04-09 16:25:48 -04:00
Pierre-Yves David
048d1e69ee bundle2: test hooking using the new transaction-level hook
There is no strong reason to keep a bundle2-level hook as we can use the
transaction-level hook.
2015-03-11 17:53:50 -07:00
Martin von Zweigbergk
f2bc0a75a2 test-bundle2-exchange: create temp script in $TESTTMP, not $TESTDIR
The bundle2-pushkey-hook.sh script is currently created in $TESTTMP,
and leaves an untracked file in that directory (tests/) after running.
2015-01-07 14:30:40 -08:00
Matt Harbison
8e87aedc01 tests: make a multi-statement hook in bundle2-exchange Windows compatible
This is similar to the fix in ab91e34fea50.
2014-12-24 12:07:59 -05:00
Pierre-Yves David
fe9585a642 pushkey: run hook after the lock release
The pushkey operation used to be in its own wireprotocol command and (in
practice) always be lock free when running the hook. With bundle2, it happen in
a greater scheme and a hook running locking command would get stuck. We now run
such hooks after the lock release as similar hook do.

Bundle2 test are altered to ensure we are lockfree at hook running time.
2014-12-22 15:48:39 -08:00
Eric Sumner
9823f2cb56 bundle2: lowercase part types
Since the capitalization no longer carries any meaning (previous diff), this
patch normalizes all of the bundle2 part type strings to lower case.
2014-12-17 15:11:26 -08:00
Eric Sumner
bd16762201 push: elevate phase transaction to cover entire operation
This patch series is intended to allow bundle2 push reply part handlers to
make changes to the local repository; it has been developed in parallel with
an extension that allows the server to rebase incoming changesets while applying
them.

Most pushes already open a transaction in order to sync phase information.
This diff replaces that transaction with one that spans the entire push
operation.

This transaction will be used in a later patch to guard repository changes
made during the reply handler.
2014-11-21 15:06:38 -08:00
Matt Harbison
b2eb2ec474 tests: fix another multi-statement hook for Windows
The double quotes are necessary, otherwise it tries to pipe into a program named
'short'.  An '&' could serve as a command separator on Windows instead of ';',
but I don't see any obvious way to swap these depending on the platform.  In
this case though, there really wasn't a need for multiple statements.
2014-11-20 20:07:34 -05:00
Pierre-Yves David
160c394fe7 phases: read pending data when appropriate
If we are called by a hook and pending data exists, read those.
2014-10-17 22:23:06 -07:00
Pierre-Yves David
4012eb31b0 bookmark: read pending data when appropriate
If we are called by a hook and pending data exists, read it.
2014-09-28 21:27:48 -07:00
Pierre-Yves David
0e44aeb8c0 test-bundle2: check visible data in pre/post-transaction hooks
We are about to make bookmarks and phases available for hooks.
Therefore we need a witness for this new availability. We introduce
the new hooks in a distinct changeset to reduce the noise in the ones
with actual changes.
2014-11-12 16:54:57 +00:00
Pierre-Yves David
3ace7493d7 transaction: write pending generated files
Such file are generated with a .pending prefix. It is up to the reader to
implement the necessary logic for reading pending files.

We add a test to ensure pending files are properly cleaned-up in both success and
error cases.
2014-10-17 22:19:05 -07:00
Pierre-Yves David
4cc6125cd7 exchange: use the postclose API on transaction
As with changegroup, we should wait for the transaction to be really closed
before scheduling hook execution.
2014-10-28 14:58:36 +01:00
Pierre-Yves David
130c63f6e2 changegroup: use the 'postclose' API on transaction
The post-transaction hooks run after the lock release (because hooks may want to
touch the repository), but they must only run if the transaction is successfully
closed.

We use the new 'addpostclose' method on transaction to register a callback
installing this post-lock-release call.
2014-10-28 15:44:23 +01:00
Pierre-Yves David
b3b7700935 hook: schedule run "b2x-transactionclose" for after lock release
Hooks that run after the transaction need to be able to touch the
repository. So we need to run them after the lock release. This is
similar to what the "changegroup" hook is doing in the
`addchangegroup` function.
2014-10-17 02:17:36 -07:00
Pierre-Yves David
2c1a6817be pull: call the b2x-transactionclose hook when closing the transaction
We need a wider set of hooks to process all the changes that happened during the
pull transaction. We reuse the experimental `b2x-transactionclose` hook set
from server's unbundle for consistency. This hook is experimental and will not
remains as-is forever, but this will open the door for experimentation in 3.2.
2014-10-15 04:19:37 -07:00
Pierre-Yves David
830b7b0082 pull: add source information to the transaction
The source information can, should be applied once when opening the transaction
for the pull. This will lets element processed within a bundle2 be aware of them
and open the door to running a set of hooks when closing this pull transaction.

This is similar to what is done in server's unbundle call.
2014-10-14 01:40:04 -07:00
Pierre-Yves David
03cb1a74e8 changegroup: store source and url in the hookargs dict
We store the source and url of the current data into `transaction.hookargs` this
let us inherit it from upper layers that may have created a much wider
transaction. We have to modify bundle2 at the same time to register the source
and url in the transaction. We have to do it in the same patch otherwise, the
`addchangegroup` call would fill these values and the hook calling will crash
because of the duplicated 'source' and 'url' arguments passed to the hook call.
2014-10-14 00:06:46 -07:00
Mike Hommey
14669879bf changegroup: use a copy of hookargs when invoking the changegroup hook
addchangegroup creates a runhook function that is used to invoke the
changegroup and incoming hooks, but at the time the function is called,
the contents of hookargs associated with the transaction may have been
modified externally. For instance, bundle2 code affects it with
obsolescence markers and bookmarks info.

It also creates problems when a single transaction is used with multiple
changegroups added (as per an upcoming change), whereby the contents
of hookargs are that of after adding a latter changegroup when invoking
the hook for the first changegroup.
2014-10-16 15:54:53 +09:00
Pierre-Yves David
35dd781a8f test-bundle2-exchange: do not drop HG_NODE from the hook output
HG_NODE is precisely something we would like to test.
2014-10-16 03:22:51 -07:00
Durham Goode
312ed291dd obsolete: update tests to use obsolete options
The obsolete._enabled flag has become a config option. This updates all but one
of the tests to use the minimal number of flags necessary for them to pass.  For
most tests this is just 'createmarkers', for a couple tests it's
'allowunstable', and for even fewer it's 'exchange'.
2014-10-14 13:34:25 -07:00
Pierre-Yves David
2a99e9b2bc bookmarks: inform transaction-related hooks that some bookmarks were moved
We do not have enough information to provide any finer data, but this is still
useful information.
2014-10-12 08:29:31 -07:00
Pierre-Yves David
578b6cd317 phases: inform transaction-related hooks that a phase was moved
We do not have enough information to provide finer data, but this is still
useful information.
2014-10-12 08:03:20 -07:00
Pierre-Yves David
d263d9b9dc test-bundle2: also test the argument of the changegroup hook
We also track execution of the changegroup hook. The important information here
is to make sure the information that the transaction was processing a bundle2 is passed to
hook. This will let most hooks disable themselves while waiting for the hook
concluding bundle2 processing (the one we discovered to be not called for
pull in the previous changesets).
2014-10-13 14:52:38 -07:00
Pierre-Yves David
5f82cb2ba2 test-bundle2: test that we got appropriate hook called with appropriate data
We can notice that this transaction wide hook is only happening during push and
it is missing changegroup-related information. We'll want to fix this but this
is not what this patch is about.
2014-10-13 14:47:36 -07:00
Pierre-Yves David
ba05aeb114 bundle2: split test in two
We split the test between the one dedicated to the binary format and the one
dedicated to checking the exchange of data using pull and push.
2014-10-01 23:55:22 -05:00