Commit Graph

82 Commits

Author SHA1 Message Date
Martin von Zweigbergk
63c15f247e changegroup3: introduce experimental.changegroup3 boolean config
In order to give us the freedom to change the changegroup3 format,
let's hide it behind an experimental config. Since it is required by
treemanifests, that will override the cg3 config.
2016-01-12 21:23:45 -08:00
Mateusz Kwapich
6688b1c845 hooks: add HG_NODE_LAST to txnclose and changegroup hook environments
Sometimes a txnclose or changegroup hook wants to iterate through all
the changesets in transaction: in that situation usually the revset
`$HG_NODE:` is used to select the revisions. Unfortunately this revset
sometimes may contain too many changesets because we don't have the
write lock while the hook runs newer changes may be added to
repository in the meantime.

That's why there is a need for extra variable carrying the information about
the last change in the transaction.
2016-01-05 17:37:59 -08:00
Augie Fackler
d33d6a0cb5 changegroup: introduce cg3, which has support for exchanging treemanifests
I'm not entirely happy with using a trailing / on a "file" entry for
transferring a treemanifest. We've discussed putting some flags on
each file header[0], but I'm unconvinced that's actually any better:
if we were going to add another feature to the cg format we'd still be
doing a version bump anyway to cg4, so I'm inclined to not spend time
coming up with a more sophisticated format until we actually know what
the next feature we want to stuff in a changegroup will be.

Test changes outside test-treemanifest.t are only due to the new CG3
bundlecap showing up in the wire protocol.

Many thanks to adgar@google.com and martinvonz@google.com for helping
me with various odd corners of the changegroup and treemanifest API.

0: It's not hard refactoring, nor is it a lot of work. I'm just
disinclined to do speculative work when it's not clear what the
customer would actually be.
2015-12-11 11:23:49 -05:00
Matt Harbison
66fa6febb4 test-ssh: stop quoting dummyssh invocation for Windows
The other invocations aren't quoted, and Windows doesn't like the single quotes:

  diff --git a/tests/test-ssh.t b/tests/test-ssh.t
  --- a/tests/test-ssh.t
  +++ b/tests/test-ssh.t
  @@ -520,20 +520,8 @@ remote hook failure is attributed to rem
     $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc

     $ hg -q --config ui.ssh="python '$TESTDIR/dummyssh'" clone ssh://user@dummy/remote hookout
  +  abort: no suitable response from remote hg!
  +  [255]
     $ cd hookout
  +  $TESTTMP.sh: line 264: cd: hookout: No such file or directory
     $ touch hookfailure
  -  $ hg -q commit -A -m 'remote hook failure'
  ....
2015-11-16 13:44:27 -05:00
Pierre-Yves David
5bec2ff818 test: use generaldelta in 'test-ssh.t'
This has effects on the capabilities string.
2015-10-20 13:14:04 +02:00
Gregory Szorc
059667a51c bundle2: attribute remote failures to remote (issue4788)
Before bundle2, hook output from hook failures was prefixed with
"remote: ". Up to this point with bundle2, the output was converted to
the message to print in an Abort exception. This had 2 implications:

1) It was unclear whether an error message came from the local repo
   or the remote
2) The exit code changed from 1 to 255

This patch changes the handling of error:abort bundle2 parts during push
to prefix the error message with "remote: ". This restores the old
behavior.

We still preserve the behavior of raising an Abort during bundle2
application failure. This is a regression from pre-bundle2 because the
exit code changed.

Because we no longer raise an Abort with the remote's message, we needed
to insert a message for the new Abort. So, I invented a new error
message for that. This is another change from pre-bundle2. However, I
like the new error message because it states unambiguously who aborted
the push failed, which I think is important for users so they can decide
what's next.
2015-10-24 00:39:22 +01:00
Gregory Szorc
34a39c5786 tests: add tests for remote hook output (issue4788)
The added tests don't agree in their output. This demonstrates a
difference in `hg push` behavior between pre-bundle2 and bundle2.
A subsequent patch will attempt to restore some of the pre-bundle2
behavior to bundle2.
2015-10-24 00:39:26 +01:00
Yuya Nishihara
69537fb219 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Before this patch, repo could be set to None for wrong -R. It's okay for
commands that can reject repo=None, but the command server have a problem
because:

 - it accepts repo=None for "unbound" mode
 - and it reenters dispatch() where repo object is created for cwd by default

Test outputs are changed because the error is detected earlier. I think new
message is better than ".hg not found".
2015-08-31 23:29:15 +09:00
Yuya Nishihara
4ae9b32bb2 test-ssh: remove superfluous triple slashes from absolute path test
Because pwd should start with "/", "/`pwd`" is enough to make absolute path.
2015-09-01 16:38:52 +09:00
Matt Harbison
de473412b1 tests: restore 'python' and '$TESTDIR/' for dummyssh invocation
This is a backout of 93589179c542, and a partial backout of 9b1628b91e74.

Windows won't execute 'dummyssh' directly, presumably because CreateProcess()
doesn't know how to execute a bash script:

   $ hg clone -e "dummyssh" ssh://user@dummy/cloned sshclone
   remote: 'dummyssh' is not recognized as an internal or external command,
   remote: operable program or batch file.
   abort: no suitable response from remote hg!
   [255]

With the restoration of python as the executable, $TESTDIR needs to be restored
for these invocations, because python won't search $PATH for 'dummyssh':

   $ hg clone -e "python dummyssh" ssh://user@dummy/cloned sshclone
   remote: python: can't open file 'dummyssh': [Errno 2] No such file or directory
   abort: no suitable response from remote hg!
   [255]
2015-06-09 21:39:33 -04:00
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 Harbison
00ffabfaf0 test-ssh: stablize for platform-specific shell quoting
Windows and OpenVMS use double quotes instead of single.
2015-06-09 00:02:02 -04: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
Matt Mackall
c64d336faa tests: simplify calls to dummyssh
dummyssh is marked executable and is in the path, no need for python,
TESTDIR, or quotes.
2015-06-08 15:02:49 -05:00
Pierre-Yves David
b4290f7a14 sshpeer: use the doublepipe object for the server to client channel
This restores real-time output from ssh server while waiting for protocol data
sent by the server.
2015-05-20 11:41:48 -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
Pierre-Yves David
cf1fa4bc36 wireprotocol: distinguish list and set in getbundle argument
The 'bundlecaps' argument is expected to be a set, but 'listkeys' is
expected to be a list where ordering matters. We introduce a new 'scsv'
argument type for the 'set' version and move 'csv' to the 'list'
version.

'test-ssh.t' is changed because this introduced an instability in the order we
were producing listkeys parts.
2015-06-01 10:28:40 -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
cbaf7b4e5e test: use bundle2 in test-ssh
Now that we have a bundle1 version of this test, we can move the main
version to bundle2. This lets us handle the ouput change from using
the bundle2 protocol earlier.
2015-05-27 11:57:20 -07:00
Pierre-Yves David
662f0bd556 pull: only list remote bookmarks if -B is used to populate pulled heads
Listing remote bookmarks results in network traffic and latency. This
should be avoided when possible.
2015-05-28 13:55:03 -07:00
Pierre-Yves David
c7946f172c listkey: display the size of the listkey payload in a debug message
This is a useful information to have in general and we already have debug
output related to listkeys. I'm planning to play around with massive amount of
phases roots and bookmarks so having this data in debug will be very useful.
This already got me to spot that one of the Logilab's review repo is exchanging
65KB of phases data during each exchanges.
2015-05-28 23:49:19 -07:00
Pierre-Yves David
688ba8b97e ssh: test some no-op pull through ssh with --debug
It appears that we are never running any wireprotocol operation with a --debug
flag. So we are adding some basic testing into 'test-ssh.t'
2015-05-29 00:09:36 -07:00
Pierre-Yves David
175fe35444 hg-ssh: reject push earlier (on pretxnopen)
We now have a lock triggered for any transaction. We use it to ensure no-read
are made in read-only mode. We need more that just "no changegroup is added",
since bundle2 allows for more than just changegroup to be exchanged.  We still
protect pushkey as it may write data without opening a transaction.
2015-05-10 04:39:11 -07: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
Thomas Arendsen Hein
498dfaa7d6 pull: print "pulling from foo" before accessing the other repo
1. This is consistent with pushing.
2. This allows to see the URL of the other repo in case accessing the repo
   fails, e.g. wrong ssh path or issues with the https certificate, without
   using --debug or showconfig paths.

Additionally add test for this in the context of ssh with a wrong path.
2015-02-24 10:55:24 +01:00
Pierre-Yves David
1e785e1322 pushkey: gracefully handle prepushkey hook failure (issue4455)
This allow to gracefully report the failure of the bookmark push and carry on.
Before this change set. Local push would plain quit and wireprotocol would
failed in various ungraceful way.
2014-11-29 19:17:47 -08:00
Matt Mackall
738a03c0f6 clone: properly mark branches closed with --uncompressed (issue4428)
On streaming clone, we were priming the local branch cache with the
remote branchmap, without checking which heads were closed.

This fixes an issue introduced in:

 changeset:   17740:f8d7aaf86507
 user:        Tomasz Kleczek <tomasz.kleczek@fb.com>
 date:        Wed Oct 03 13:19:53 2012 -0700
 summary:     branchcache: fetch source branchcache during clone (issue3378)

that was exposed in 2.9 by:

 changeset:   20192:6c385e85aa05
 user:        Brodie Rao <brodie@sf.io>
 date:        Mon Sep 16 01:08:29 2013 -0700
 summary:     branches: simplify with repo.branchmap().iterbranches()
2014-11-01 17:30:57 -05: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
23ce37ca7e pull: merge bookmark updates and imports
We do all the things in one go now, updating existing bookmark, adding new ones,
and overwriting the ones explicitly specified for --bookmark. This impacts the
tests by removing some duplicated or unnecessary output.
2014-09-28 14:07:56 -07:00
Gregory Szorc
d584614776 test-ssh: verify that stderr from remote is printed (issue4336)
The issue fixed in the previous patch was uncovered by implementing an
extension that printed additional output locally before the push command
completed. This test emulates that.

If this change is applied before the previous patch, the test will fail
on Linux, with the local output being printed before the "remote: "
lines.
2014-08-16 10:19:26 -07:00
Mads Kiilerich
8b72c846ed httppeer: reintroduce _abort that accidentally was removed in fc14a1cf743e
Including the missing test coverage that would have caught it.
2014-04-23 23:29:55 +02:00
Mads Kiilerich
303021da0b discovery: improve "note: unsynced remote changes!" warning
This message frequently caused confusion. "unsynced" is not a well established
user-facing concept in Mercurial and the message was not very specific or
helpful.

Instead, show a message like:
  remote has heads on branch 'default' that are not known locally: 6c0482d977a3

This message will also (when relevant) be shown before aborting on "push
creates new remote head".

A similar (but actually very different) message was addressed in cbd5a12a601a.
2014-02-06 02:19:38 +01:00
Matt Mackall
5a04f42dce push: backout b359130ef1bc due to test failures 2014-02-09 17:31:26 -06:00
Mads Kiilerich
fee088299f discovery: improve "note: unsynced remote changes!" warning
This note (which actually is a warning) frequently caused confusion.
"unsynced" is not a well established user-facing concept in Mercurial and the
message was not very specific or helpful.

Instead, show a messages like:
  remote has heads on branch 'default' that are not known locally: 6c0482d977a3
and show it before aborting on "push creates new remote head". This will also
give more of a hint in the case where the branch has been closed remotely and
'hg heads' thus not would show any new heads after pulling.

A similar (but actually very different) message was addressed in cbd5a12a601a.
2014-02-06 02:19:38 +01:00
Mads Kiilerich
8cb1e5208b debugpushkey: list keys sorted 2012-12-16 20:50:57 +01:00
Matt Mackall
86c978bc2c clone: don't %-escape the default destination (issue3145) 2012-10-19 14:47:55 -05:00
Pierre-Yves David
fd393b84f3 pushkey: do not exchange obsole markers if feature is disabled
This apply to both push and pull both when client or server.
2012-07-28 13:33:06 +02: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
Pierre-Yves.David@ens-lyon.org
d60eedc2d6 obsolete: exchange obsolete marker over pushkey
For a version of the exchange, all markers are exchange. This won't
scale and we will need a better protocol later.
2012-06-07 19:21:59 +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
Mads Kiilerich
ccfffc07ba tests: add missing no-outer-repo requirements
Outer repos (if any) will now never be touched by the tests. But it is better
to run without any repos around the tmp directory.
2012-06-20 23:41:21 +02:00
Adrian Buehlmann
b761076e81 tests/printenv.py: eliminate trailing spaces on output 2012-06-17 00:27:31 +02:00
Martin Geisler
a06bcd028f serve: lowercase "no repo here" message 2012-06-12 14:18:18 +02:00
Adrian Buehlmann
cc8d5d2d8e tests/run-tests: avoid C:/ in arguments
MSYS replaces C:/... in arguments with C;... as it interprets the C:/ as a
colon separated POSIX path list. The colon is replaced with ; (path separator
on Windows) according to

  http://www.mingw.org/wiki/Posix_path_conversion

So we must not replace \ with / for neither $TESTTMP nor $TESTDIR, but we
have to keep replacing \ with / for the Popen4 call of function hghave. If we
don't do the latter, test-run-tests.t will fail with

  $ python run-tests.py --local test-run-tests.t

  --- C:\Users\adi\hgrepos\hg-main\tests\test-run-tests.t
  +++ C:\Users\adi\hgrepos\hg-main\tests\test-run-tests.t.err
  @@ -70,6 +70,7 @@
     tested
   #else
     $ echo skipped
  +  skipped
   #endif

   #if false


An additional tweak in test-ssh.t is needed that globs away an encoded path,
as it can't be translated back to $TESTTMP, because the backslashes in the
output have been already encoded as %5C.

This patch makes test-ssh.t pass in MSYS on Windows.
2012-06-10 03:05:59 +02:00
David Schleimer
499f4df5a8 hg-ssh: read-only flag
Allows you to restrict a ssh key to have read-only access to a set of
repos by passing the --read-only flag to hg-ssh.

This is useful in an environment where the number of unix users you
can or are willing to create is limited.  In such an environment,
multiple users or applications will share a single unix account.  Some
of those applications will likely need read-only access to the
repository.  This change makes it possible to grant them such access
without requiring that they use a separate unix account.
2012-05-22 15:17:37 -07:00
Mads Kiilerich
64a9bbd95b tests: improve test of hg-ssh and make the test pass on windows 2012-05-07 00:52:11 +02:00
Mads Kiilerich
91529dce53 hg-ssh: use %s for printing paths in error messages
This avoids \\ if this ever is run on windows - for example in the test suite.
2012-05-07 00:49:01 +02:00