Commit Graph

37 Commits

Author SHA1 Message Date
Pierre-Yves David
e567efc154 bundle2: convey PushkeyFailed error over the wire
We add a way to convey the precise exception. This will allow better error
message on the server.
2015-06-10 13:10:53 -04:00
Pierre-Yves David
8956fcc604 bundle2: add an 'error' capability
This capability will be extended as new error type is introduced.
2015-06-06 00:32:19 -07:00
Matt Mackall
36e5db11e5 tests: simplify printenv calls
Make printenv executable so that we don't need python, TESTDIR, or
quoting.
2015-06-08 15:10:15 -05:00
Pierre-Yves David
f78d887c9a test: drop all the forced use of bundle2
Using bundle2 during exchange is now the default, we do not need all this
explicit enabling of bundle2 exchange in test anymore.
2015-05-27 22:11:37 -07:00
Gregory Szorc
a7e363e0cf bundle2: part handler for processing .hgtags fnodes mappings
.hgtags fnodes cache entries can be expensive to compute, especially
if there are hundreds of even thousands of them. This patch implements
support for receiving a bundle2 part that contains a mapping of
changeset to .hgtags fnodes.

An upcoming patch will teach the server to send this part, allowing
clients to bypass having to redundantly compute these values.

A number of tests changed due to the client advertising the "hgtagsfnodes"
capability.
2015-06-01 20:23:22 -07:00
Pierre-Yves David
9bdc85760e test: use bundle2 in test-http
Now that we have a bundle1 version of this test, we can move the
original to bundle2. This lets us handle the ouput change from using
the bundle2 protocol earlier.
2015-05-27 12:05:08 -07:00
Gilles Moris
0226ba418b test-http: drop compatibility check on Python >= 2.4.3
This is obsolete now that Python < 2.6 is no more supported.
This is thus a backout of fce95ba9c79d.
2015-05-15 10:24:59 +02: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
Siddharth Agarwal
2a54eb4599 localrepo.clone: add a way to override server preferuncompressed
Without this patch, if the server sets preferuncompressed, there's no way for
clients to override that and force a non-streaming clone. With this patch, we
extend the meaning of --pull to also override preferuncompressed and force a
non-streaming clone.
2014-12-12 14:06:36 -08:00
Durham Goode
a9c8623638 clone: fix copying bookmarks in uncompressed clones (issue4430)
8a92e6790099 broke bookmarks getting copied during uncompressed clones. Since
most of the pull logic has been moved into exchange.py, lets just call
exchange.pull to fix up the repo with the latest bits after the streaming clone
has bootstrapped the repo. This keeps us from having to duplicate the bookmark
logic.
2014-10-31 12:56:25 -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
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
f84dab4656 clone: remove duplicated bookmark pulling
Now that all clone methods (copy, pull and push) also transport bookmarks, we can
safely drop the manual pulling that was performed during clone.
2014-09-26 13:56:20 -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
Matt Mackall
11be5cc27c tests: replace exit 80 with #require 2014-08-06 11:43:59 -05: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
fddf556ac8 phase: apply publishing enforcement for "serve" source
When a changegroup is added by a push on a publishing server, we ensure they
are added as public. This is used to enforce publishing on server when the
client is not aware of phases. It also prevents race conditions where a reader
could see the changesets as draft before they get turned public by the client.
Finally, this save rounds trip as the client does not need additional request to
turn them public.

However, this logic was only enforced when the changegroup was from a "push"
source. And "push" is used for local pushes only. Wireprotocol push uses "serve"
as source since Mercurial 1.9. We now enforce this logic for both "push" and
"serve" sources.

One could note that this logic was mainly useful during wireprotocol exchanges.
So this code is finally put into good use, 9 versions after its introduction.
2014-04-07 18:10:50 -07:00
Stéphane Klein
f029558dda http: reuse authentication info after the first failed request (issue3567)
[This was applied in df58533adb15 but backed out again in 8127f169caa4 because
of Python 2.4 issues. This edition and test-http.t works with Python 2.4.]

Context: mercurial access to repository server with http access, and this
server is protected by basic auth.

Before patch:

* mercurial try an anonymous access to server, server return 401 response and
  mercurial resend request with login / password information

After patch:

* mercurial try an anonymous access to server, server return
  401 response. For all next requests, mercurial keep in memory this
  information (this server need basic auth information).

This patch reduce the number of http access against mercurial server.

Example, before patch:

10.10.168.170 - - [25/Oct/2013:15:44:51 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:44:52 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:00 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:01 +0200] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:03 +0200] "GET /hg/testagt?cmd=batch
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:04 +0200] "GET /hg/testagt?cmd=batch
HTTP/1.1" 200 42 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:06 +0200] "GET /hg/testagt?cmd=getbundle
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:07 +0200] "GET /hg/testagt?cmd=getbundle
HTTP/1.1" 200 61184 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:09 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:10 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 15 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:12 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [25/Oct/2013:15:45:12 +0200] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 - "-" "mercurial/proto-1.0"

Example after patch:

10.10.168.170 - - [28/Oct/2013:11:49:14 +0100] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 401 260 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:15 +0100] "GET /hg/testagt?cmd=capabilities
HTTP/1.1" 200 147 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:17 +0100] "GET /hg/testagt?cmd=batch
HTTP/1.1" 200 42 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:19 +0100] "GET /hg/testagt?cmd=getbundle
HTTP/1.1" 200 61184 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:22 +0100] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 15 "-" "mercurial/proto-1.0"
10.10.168.170 - - [28/Oct/2013:11:49:24 +0100] "GET /hg/testagt?cmd=listkeys
HTTP/1.1" 200 - "-" "mercurial/proto-1.0"

In this last example, you can see only one 401 response.
2013-12-20 14:56:05 +01:00
Mads Kiilerich
3341cf857f tests: improved test coverage for HTTP authentication and 401 responses
Dump the access log to verify that the client gets the 401s it deserves and
handles them correctly. This establishes a baseline for Basic authentication
protocol.
2014-02-05 01:41:36 +01:00
Mads Kiilerich
59b97fe104 tests: ignore http tests that are known wontfix failures on python 2.4
As mentioned on http://bz.selenic.com/show_bug.cgi?id=2739#c17 , babf177f9036
left test-http.t failing on Python < 2.4.3. That has not been noticed because
most 2.4 testing has been done with a patched 2.4.2.

This makes sure that the tests only are run for Python >= 2.4.3. That makes it
possible to verify that everything else works with Python 2.4.
2014-02-05 01:37:37 +01:00
Lucas Moscovicz
178ffcb15d url: added authuri when login information is requested (issue3209)
When users are using a revset they can get multiple password prompts.
This prompts have no extra information about which password is being requested
so I added the authuri to the prompt to make it recognizable.

As in:
$ hg log -r "outgoing('https://bitbucket.org/mg/test') -
outgoing('https://bitbucket.org/nesneros/test')"
http authorization required
realm: Bitbucket.org HTTP
user: interrupted!

I changed it to describe the url when prompting for password.
As in:
$ hg log -r "outgoing('https://bitbucket.org/mg/test') -
outgoing('https://bitbucket.org/nesneros/test')"
http authorization required for https://bitbucket.org/mg/test
realm: Bitbucket.org HTTP
user: interrupted!
2014-01-15 16:46:20 -08:00
Augie Fackler
5200764eb8 clone: don't fail with --update for non-local clones (issue3578)
This was broken by e01343f7da6f due to lack of test coverage. This
adds a test and fixes the defect.
2012-08-08 10:04:02 -05:00
Brad Hall
6b8032746f tag: don't allow tagging the null revision (issue1915)
Also fixed the tests that were doing this and expected it to work
2012-06-05 17:00:13 -07:00
Adrian Buehlmann
41fcaa827d test-http and test-https: partially adapt for Windows 2012-06-19 19:45:00 +02:00
Mads Kiilerich
a8107f523f tests: consistently use printenv.py the same MSYS/Windows-compatible way
This will remove some reasons some tests are disabled on Windows.
2012-06-21 03:05:02 +02:00
Adrian Buehlmann
b761076e81 tests/printenv.py: eliminate trailing spaces on output 2012-06-17 00:27:31 +02:00
Benoit Allard
ed90b14694 protocol: Add the stream-preferred capability
This makes the client use the uncompressed protocol.
2012-04-04 00:00:47 +02:00
Mads Kiilerich
8415df7277 tests: use 'hghave serve' to guard tests that requires serve daemon management 2011-11-07 03:24:53 +01:00
Mads Kiilerich
a9383c13c5 subrepo: fix cloning of repos from urls without slash after host (issue2970)
This fixes a regression introduced with the new url handling in 1.9.

This should perhaps be fixed in the url class instead, but that might be too
invasive for a stable bugfix.
2011-08-26 16:23:35 +02:00
Mads Kiilerich
6c5f486f38 test-http: test http authentication
The extension hack is based on Henrik Stuart's hg-textauth.
2011-08-05 00:39:54 +02:00
Peter Arrenbrecht
66c54cef75 bundlerepo: fix and improve getremotechanges
Fixes the regression where incoming could show local changes
introduced by rev eecf03f0ef7c.
2011-05-02 12:36:23 +02:00
Thomas Arendsen Hein
f0eec1822c tests: check for (*/sec) instead of (*B/sec) to match (X bytes/sec)
I just had: transferred 606 bytes in 2.9 seconds (211 bytes/sec)
2011-04-29 11:04:39 +02:00
Mads Kiilerich
53a7e81f78 hgweb: handle invalid requests with both form data and querystring
Invalid requests could give an unhandled ErrorResponse.

Now this ErrorResponse is handled like other ErrorResponses so the client gets
an error message which also is logged on the server.
2011-02-21 00:57:19 +01:00
Mads Kiilerich
e4660104cf util: flush stdout before calling external processes
stdout could have content in its buffer while a subprocess ran and emitted
output.

Flushing stdout ensures that output now comes in the right order.
2011-02-18 03:35:01 +01:00
Mads Kiilerich
3e84017cf0 tests: use printenv.py where it is - don't copy it around 2011-02-15 02:17:43 +01:00
Mads Kiilerich
e490eeec3f tests: reintroduce ":$HGPORT" in test output
This reduces the number of patterns that must be adjusted when writing tests.
2010-10-08 22:36:11 -05:00
Matt Mackall
692a52d686 tests: unify test-http 2010-09-26 13:41:32 -05:00