2010-09-26 22:41:32 +04:00
|
|
|
|
|
|
|
This test tries to exercise the ssh functionality with a dummy script
|
|
|
|
|
2015-10-20 14:14:04 +03:00
|
|
|
$ cat <<EOF >> $HGRCPATH
|
|
|
|
> [format]
|
|
|
|
> usegeneraldelta=yes
|
|
|
|
> EOF
|
|
|
|
|
2011-05-05 03:47:46 +04:00
|
|
|
creating 'remote' repo
|
2010-09-26 22:41:32 +04:00
|
|
|
|
|
|
|
$ hg init remote
|
|
|
|
$ cd remote
|
|
|
|
$ echo this > foo
|
|
|
|
$ echo this > fooO
|
|
|
|
$ hg ci -A -m "init" foo fooO
|
2014-11-02 01:30:57 +03:00
|
|
|
|
|
|
|
configure for serving
|
|
|
|
|
2011-05-05 03:47:46 +04:00
|
|
|
$ cat <<EOF > .hg/hgrc
|
2010-11-12 10:21:45 +03:00
|
|
|
> [server]
|
|
|
|
> uncompressed = True
|
|
|
|
>
|
|
|
|
> [hooks]
|
tests: invoke printenv.py via sh -c for test portability
On Windows platform, invoking printenv.py directly via hook is
problematic, because:
- unless binding between *.py suffix and python runtime, application
selector dialog is displayed, and running test is blocked at each
printenv.py invocations
- it isn't safe to assume binding between *.py suffix and python
runtime, because application binding is easily broken
For example, installing IDE (VisualStudio with Python Tools, or
so) often requires binding between source files and IDE itself.
This patch invokes printenv.py via sh -c for test portability. This is
a kind of follow up for 9e4331825bea, which eliminated explicit
"python" for printenv.py. There are already other 'sh -c "printenv.py"'
in *.t files, and this fix should be reasonable.
This changes were confirmed in cases below:
- without any application binding for *.py suffix
- with binding between *.py suffix and VisualStudio
This patch also replaces "echo + redirection" style with "heredoc"
style, because:
- hook command line is parsed by cmd.exe as shell at first, and
- single quotation can't quote arguments on cmd.exe, therefore,
- "printenv.py foobar" should be quoted by double quotation, but
- nested quoting (or tricky escaping) isn't readable
2016-10-28 20:44:45 +03:00
|
|
|
> changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog"
|
2010-11-12 10:21:45 +03:00
|
|
|
> EOF
|
2010-09-26 22:41:32 +04:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
repo not found error
|
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
|
2015-08-31 17:29:15 +03:00
|
|
|
remote: abort: repository nonexistent not found!
|
2010-09-26 22:41:32 +04:00
|
|
|
abort: no suitable response from remote hg!
|
|
|
|
[255]
|
|
|
|
|
|
|
|
non-existent absolute path
|
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/nonexistent local
|
2015-08-31 17:29:15 +03:00
|
|
|
remote: abort: repository $TESTTMP/nonexistent not found!
|
2010-09-26 22:41:32 +04:00
|
|
|
abort: no suitable response from remote hg!
|
|
|
|
[255]
|
|
|
|
|
|
|
|
clone remote via stream
|
|
|
|
|
2017-10-01 13:29:20 +03:00
|
|
|
$ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
|
2010-09-26 22:41:32 +04:00
|
|
|
streaming all changes
|
2019-02-09 00:27:50 +03:00
|
|
|
4 files to transfer, 392 bytes of data
|
|
|
|
transferred 392 bytes in 0.0 seconds (383 KB/sec)
|
2014-10-31 22:56:25 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
2010-09-26 22:41:32 +04:00
|
|
|
updating to branch default
|
2010-09-26 22:44:49 +04:00
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2010-09-26 22:41:32 +04:00
|
|
|
$ cd local-stream
|
|
|
|
$ hg verify
|
|
|
|
checking changesets
|
|
|
|
checking manifests
|
|
|
|
crosschecking files in changesets and manifests
|
|
|
|
checking files
|
2019-02-09 00:27:50 +03:00
|
|
|
2 files, 1 changesets, 2 total revisions
|
2010-09-26 22:41:32 +04:00
|
|
|
$ cd ..
|
|
|
|
|
2014-10-31 22:56:25 +03:00
|
|
|
clone bookmarks via stream
|
|
|
|
|
|
|
|
$ hg -R local-stream book mybook
|
2017-10-01 13:29:20 +03:00
|
|
|
$ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
|
2014-10-31 22:56:25 +03:00
|
|
|
streaming all changes
|
2019-02-09 00:27:50 +03:00
|
|
|
4 files to transfer, 392 bytes of data
|
|
|
|
transferred 392 bytes in 0.0 seconds (383 KB/sec)
|
2014-10-31 22:56:25 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
updating to branch default
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd stream2
|
|
|
|
$ hg book
|
|
|
|
mybook 0:1160648e36ce
|
|
|
|
$ cd ..
|
|
|
|
$ rm -rf local-stream stream2
|
|
|
|
|
2010-09-26 22:41:32 +04:00
|
|
|
clone remote via pull
|
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
|
2010-09-26 22:41:32 +04:00
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
2019-02-09 00:27:50 +03:00
|
|
|
added 1 changesets with 2 changes to 2 files
|
|
|
|
new changesets 1160648e36ce
|
2010-09-26 22:41:32 +04:00
|
|
|
updating to branch default
|
|
|
|
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
verify
|
|
|
|
|
|
|
|
$ cd local
|
|
|
|
$ hg verify
|
|
|
|
checking changesets
|
|
|
|
checking manifests
|
|
|
|
crosschecking files in changesets and manifests
|
|
|
|
checking files
|
2019-02-09 00:27:50 +03:00
|
|
|
2 files, 1 changesets, 2 total revisions
|
tests: invoke printenv.py via sh -c for test portability
On Windows platform, invoking printenv.py directly via hook is
problematic, because:
- unless binding between *.py suffix and python runtime, application
selector dialog is displayed, and running test is blocked at each
printenv.py invocations
- it isn't safe to assume binding between *.py suffix and python
runtime, because application binding is easily broken
For example, installing IDE (VisualStudio with Python Tools, or
so) often requires binding between source files and IDE itself.
This patch invokes printenv.py via sh -c for test portability. This is
a kind of follow up for 9e4331825bea, which eliminated explicit
"python" for printenv.py. There are already other 'sh -c "printenv.py"'
in *.t files, and this fix should be reasonable.
This changes were confirmed in cases below:
- without any application binding for *.py suffix
- with binding between *.py suffix and VisualStudio
This patch also replaces "echo + redirection" style with "heredoc"
style, because:
- hook command line is parsed by cmd.exe as shell at first, and
- single quotation can't quote arguments on cmd.exe, therefore,
- "printenv.py foobar" should be quoted by double quotation, but
- nested quoting (or tricky escaping) isn't readable
2016-10-28 20:44:45 +03:00
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [hooks]
|
|
|
|
> changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog"
|
|
|
|
> EOF
|
2010-09-26 22:41:32 +04:00
|
|
|
|
|
|
|
empty default pull
|
|
|
|
|
|
|
|
$ hg paths
|
|
|
|
default = ssh://user@dummy/remote
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
|
2010-09-26 22:41:32 +04:00
|
|
|
pulling from ssh://user@dummy/remote
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
|
2015-02-24 12:55:24 +03:00
|
|
|
pull from wrong ssh URL
|
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
|
2015-02-24 12:55:24 +03:00
|
|
|
pulling from ssh://user@dummy/doesnotexist
|
2015-08-31 17:29:15 +03:00
|
|
|
remote: abort: repository doesnotexist not found!
|
2015-02-24 12:55:24 +03:00
|
|
|
abort: no suitable response from remote hg!
|
|
|
|
[255]
|
|
|
|
|
2010-09-26 22:41:32 +04:00
|
|
|
local change
|
|
|
|
|
|
|
|
$ echo bleah > foo
|
|
|
|
$ hg ci -m "add"
|
|
|
|
|
|
|
|
updating rc
|
|
|
|
|
|
|
|
$ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
|
|
|
|
$ echo "[ui]" >> .hg/hgrc
|
2017-07-07 08:05:20 +03:00
|
|
|
$ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
|
2010-09-26 22:41:32 +04:00
|
|
|
|
|
|
|
find outgoing
|
|
|
|
|
|
|
|
$ hg out ssh://user@dummy/remote
|
|
|
|
comparing with ssh://user@dummy/remote
|
|
|
|
searching for changes
|
2019-02-09 00:27:50 +03:00
|
|
|
changeset: 1:a28a9d1a809c
|
2010-09-26 22:41:32 +04:00
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: add
|
|
|
|
|
|
|
|
|
|
|
|
find incoming on the remote side
|
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
|
2010-09-26 22:41:32 +04:00
|
|
|
comparing with ssh://user@dummy/local
|
|
|
|
searching for changes
|
2019-02-09 00:27:50 +03:00
|
|
|
changeset: 1:a28a9d1a809c
|
2010-09-26 22:41:32 +04:00
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: add
|
|
|
|
|
|
|
|
|
2010-09-26 23:35:52 +04:00
|
|
|
find incoming on the remote side (using absolute path)
|
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
|
2010-10-09 07:36:10 +04:00
|
|
|
comparing with ssh://user@dummy/$TESTTMP/local
|
2010-09-26 23:35:52 +04:00
|
|
|
searching for changes
|
2019-02-09 00:27:50 +03:00
|
|
|
changeset: 1:a28a9d1a809c
|
2010-09-26 23:35:52 +04:00
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: add
|
|
|
|
|
|
|
|
|
2010-09-26 22:41:32 +04:00
|
|
|
push
|
|
|
|
|
|
|
|
$ hg push
|
|
|
|
pushing to ssh://user@dummy/remote
|
|
|
|
searching for changes
|
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
$ cd ../remote
|
|
|
|
|
|
|
|
check remote tip
|
|
|
|
|
|
|
|
$ hg tip
|
2019-02-09 00:27:50 +03:00
|
|
|
changeset: 1:a28a9d1a809c
|
2010-09-26 22:41:32 +04:00
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: add
|
|
|
|
|
|
|
|
$ hg verify
|
|
|
|
checking changesets
|
|
|
|
checking manifests
|
|
|
|
crosschecking files in changesets and manifests
|
|
|
|
checking files
|
2019-02-09 00:27:50 +03:00
|
|
|
2 files, 2 changesets, 3 total revisions
|
2010-09-26 22:41:32 +04:00
|
|
|
$ hg cat -r tip foo
|
|
|
|
bleah
|
|
|
|
$ echo z > z
|
|
|
|
$ hg ci -A -m z z
|
|
|
|
|
2010-11-12 10:21:45 +03:00
|
|
|
test pushkeys and bookmarks
|
2010-09-26 22:41:32 +04:00
|
|
|
|
|
|
|
$ cd ../local
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
|
2010-11-12 10:21:45 +03:00
|
|
|
bookmarks
|
|
|
|
namespaces
|
2012-12-16 23:50:57 +04:00
|
|
|
phases
|
2010-11-12 10:21:45 +03:00
|
|
|
$ hg book foo -r 0
|
|
|
|
$ hg out -B
|
|
|
|
comparing with ssh://user@dummy/remote
|
|
|
|
searching for changed bookmarks
|
|
|
|
foo 1160648e36ce
|
|
|
|
$ hg push -B foo
|
|
|
|
pushing to ssh://user@dummy/remote
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
exporting bookmark foo
|
2012-01-31 01:56:35 +04:00
|
|
|
[1]
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
|
2010-11-12 10:21:45 +03:00
|
|
|
foo 1160648e36cec0054048a7edc4110c6f84fde594
|
|
|
|
$ hg book -f foo
|
2010-11-29 03:21:47 +03:00
|
|
|
$ hg push --traceback
|
2010-11-12 10:21:45 +03:00
|
|
|
pushing to ssh://user@dummy/remote
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
updating bookmark foo
|
2012-01-30 21:32:09 +04:00
|
|
|
[1]
|
2010-11-12 10:21:45 +03:00
|
|
|
$ hg book -d foo
|
|
|
|
$ hg in -B
|
|
|
|
comparing with ssh://user@dummy/remote
|
|
|
|
searching for changed bookmarks
|
|
|
|
foo a28a9d1a809c
|
|
|
|
$ hg book -f -r 0 foo
|
|
|
|
$ hg pull -B foo
|
|
|
|
pulling from ssh://user@dummy/remote
|
|
|
|
no changes found
|
|
|
|
updating bookmark foo
|
|
|
|
$ hg book -d foo
|
|
|
|
$ hg push -B foo
|
2011-02-10 22:46:28 +03:00
|
|
|
pushing to ssh://user@dummy/remote
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
2010-11-12 10:21:45 +03:00
|
|
|
deleting remote bookmark foo
|
2012-01-31 01:56:35 +04:00
|
|
|
[1]
|
2010-11-12 10:21:45 +03:00
|
|
|
|
|
|
|
a bad, evil hook that prints to stdout
|
|
|
|
|
2011-05-05 03:47:46 +04:00
|
|
|
$ cat <<EOF > $TESTTMP/badhook
|
|
|
|
> import sys
|
|
|
|
> sys.stdout.write("KABOOM\n")
|
|
|
|
> EOF
|
|
|
|
|
2016-11-08 16:22:22 +03:00
|
|
|
$ cat <<EOF > $TESTTMP/badpyhook.py
|
|
|
|
> import sys
|
|
|
|
> def hook(ui, repo, hooktype, **kwargs):
|
|
|
|
> sys.stdout.write("KABOOM IN PROCESS\n")
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cat <<EOF >> ../remote/.hg/hgrc
|
|
|
|
> [hooks]
|
2017-07-05 19:10:11 +03:00
|
|
|
> changegroup.stdout = $PYTHON $TESTTMP/badhook
|
2016-11-08 16:22:22 +03:00
|
|
|
> changegroup.pystdout = python:$TESTTMP/badpyhook.py:hook
|
|
|
|
> EOF
|
2010-09-26 22:41:32 +04:00
|
|
|
$ echo r > r
|
|
|
|
$ hg ci -A -m z r
|
|
|
|
|
|
|
|
push should succeed even though it has an unexpected response
|
|
|
|
|
|
|
|
$ hg push
|
|
|
|
pushing to ssh://user@dummy/remote
|
|
|
|
searching for changes
|
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
remote: KABOOM
|
2016-11-08 16:22:22 +03:00
|
|
|
remote: KABOOM IN PROCESS
|
2010-09-26 22:41:32 +04:00
|
|
|
$ hg -R ../remote heads
|
2019-02-09 00:27:50 +03:00
|
|
|
changeset: 3:1383141674ec
|
2010-09-26 22:41:32 +04:00
|
|
|
tag: tip
|
2019-02-09 00:27:50 +03:00
|
|
|
parent: 1:a28a9d1a809c
|
2010-09-26 22:41:32 +04:00
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: z
|
|
|
|
|
2019-02-09 00:27:50 +03:00
|
|
|
changeset: 2:6c0482d977a3
|
2010-09-26 22:41:32 +04:00
|
|
|
parent: 0:1160648e36ce
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: z
|
|
|
|
|
2011-02-23 13:42:41 +03:00
|
|
|
|
2011-03-13 14:24:17 +03:00
|
|
|
clone bookmarks
|
|
|
|
|
|
|
|
$ hg -R ../remote bookmark test
|
|
|
|
$ hg -R ../remote bookmarks
|
2019-02-09 00:27:50 +03:00
|
|
|
* test 2:6c0482d977a3
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
|
2011-03-13 14:24:17 +03:00
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
2019-02-09 00:27:50 +03:00
|
|
|
added 4 changesets with 5 changes to 4 files (+1 heads)
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 1160648e36ce:1383141674ec
|
2011-03-13 14:24:17 +03:00
|
|
|
updating to branch default
|
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ hg -R local-bookmarks bookmarks
|
2019-02-09 00:27:50 +03:00
|
|
|
test 2:6c0482d977a3
|
2011-03-13 14:24:17 +03:00
|
|
|
|
2011-02-23 13:42:41 +03:00
|
|
|
passwords in ssh urls are not supported
|
2011-03-24 23:12:51 +03:00
|
|
|
(we use a glob here because different Python versions give different
|
|
|
|
results here)
|
2011-02-23 13:42:41 +03:00
|
|
|
|
|
|
|
$ hg push ssh://user:erroneouspwd@dummy/remote
|
2011-03-24 23:12:51 +03:00
|
|
|
pushing to ssh://user:*@dummy/remote (glob)
|
2011-02-23 13:42:41 +03:00
|
|
|
abort: password in URL not supported!
|
|
|
|
[255]
|
|
|
|
|
2010-09-26 22:41:32 +04:00
|
|
|
$ cd ..
|
2011-11-26 03:10:31 +04:00
|
|
|
|
2012-06-21 01:41:21 +04:00
|
|
|
hide outer repo
|
|
|
|
$ hg init
|
|
|
|
|
2011-11-26 03:10:31 +04:00
|
|
|
Test remote paths with spaces (issue2983):
|
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
|
2012-06-06 04:00:13 +04:00
|
|
|
$ touch "$TESTTMP/a repo/test"
|
|
|
|
$ hg -R 'a repo' commit -A -m "test"
|
|
|
|
adding test
|
2011-11-26 03:10:31 +04:00
|
|
|
$ hg -R 'a repo' tag tag
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
|
2012-06-06 04:00:13 +04:00
|
|
|
73649e48688a
|
2011-11-26 03:10:31 +04:00
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
|
2014-04-24 01:29:55 +04:00
|
|
|
abort: unknown revision 'noNoNO'!
|
|
|
|
[255]
|
|
|
|
|
2012-10-19 23:47:55 +04:00
|
|
|
Test (non-)escaping of remote paths with spaces when cloning (issue3145):
|
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
|
2012-10-19 23:47:55 +04:00
|
|
|
destination directory: a repo
|
|
|
|
abort: destination 'a repo' is not empty
|
|
|
|
[255]
|
|
|
|
|
2017-04-12 21:23:55 +03:00
|
|
|
Make sure hg is really paranoid in serve --stdio mode. It used to be
|
|
|
|
possible to get a debugger REPL by specifying a repo named --debugger.
|
|
|
|
$ hg -R --debugger serve --stdio
|
|
|
|
abort: potentially unsafe serve --stdio invocation: ['-R', '--debugger', 'serve', '--stdio']
|
|
|
|
[255]
|
|
|
|
$ hg -R --config=ui.debugger=yes serve --stdio
|
|
|
|
abort: potentially unsafe serve --stdio invocation: ['-R', '--config=ui.debugger=yes', 'serve', '--stdio']
|
|
|
|
[255]
|
|
|
|
Abbreviations of 'serve' also don't work, to avoid shenanigans.
|
|
|
|
$ hg -R narf serv --stdio
|
|
|
|
abort: potentially unsafe serve --stdio invocation: ['-R', 'narf', 'serv', '--stdio']
|
|
|
|
[255]
|
|
|
|
|
2012-05-07 02:52:11 +04:00
|
|
|
Test hg-ssh using a helper script that will restore PYTHONPATH (which might
|
|
|
|
have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
|
|
|
|
parameters:
|
|
|
|
|
|
|
|
$ cat > ssh.sh << EOF
|
|
|
|
> userhost="\$1"
|
|
|
|
> SSH_ORIGINAL_COMMAND="\$2"
|
|
|
|
> export SSH_ORIGINAL_COMMAND
|
|
|
|
> PYTHONPATH="$PYTHONPATH"
|
|
|
|
> export PYTHONPATH
|
2017-07-07 08:05:20 +03:00
|
|
|
> "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
|
2012-05-07 02:52:11 +04:00
|
|
|
> EOF
|
2011-12-08 19:28:18 +04:00
|
|
|
|
2012-05-07 02:52:11 +04:00
|
|
|
$ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
|
2012-06-06 04:00:13 +04:00
|
|
|
73649e48688a
|
2012-05-07 02:49:01 +04:00
|
|
|
|
2012-05-07 02:52:11 +04:00
|
|
|
$ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
|
2017-12-11 06:50:57 +03:00
|
|
|
remote: Illegal repository "$TESTTMP/a'repo"
|
2011-12-08 19:28:18 +04:00
|
|
|
abort: no suitable response from remote hg!
|
|
|
|
[255]
|
2012-05-07 02:49:01 +04:00
|
|
|
|
2012-05-07 02:52:11 +04:00
|
|
|
$ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
|
|
|
|
remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
|
2011-12-08 19:28:18 +04:00
|
|
|
abort: no suitable response from remote hg!
|
|
|
|
[255]
|
|
|
|
|
2017-07-05 19:10:11 +03:00
|
|
|
$ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" $PYTHON "$TESTDIR/../contrib/hg-ssh"
|
2012-05-07 02:52:11 +04:00
|
|
|
Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
|
|
|
|
[255]
|
|
|
|
|
2012-05-23 02:17:37 +04:00
|
|
|
Test hg-ssh in read-only mode:
|
|
|
|
|
|
|
|
$ cat > ssh.sh << EOF
|
|
|
|
> userhost="\$1"
|
|
|
|
> SSH_ORIGINAL_COMMAND="\$2"
|
|
|
|
> export SSH_ORIGINAL_COMMAND
|
|
|
|
> PYTHONPATH="$PYTHONPATH"
|
|
|
|
> export PYTHONPATH
|
2017-07-07 08:05:20 +03:00
|
|
|
> "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
|
2012-05-23 02:17:37 +04:00
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
|
|
|
|
requesting all changes
|
|
|
|
adding changesets
|
|
|
|
adding manifests
|
|
|
|
adding file changes
|
2019-02-09 00:27:50 +03:00
|
|
|
added 4 changesets with 5 changes to 4 files (+1 heads)
|
2017-10-12 10:39:50 +03:00
|
|
|
new changesets 1160648e36ce:1383141674ec
|
2012-05-23 02:17:37 +04:00
|
|
|
updating to branch default
|
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
|
|
|
|
$ cd read-only-local
|
|
|
|
$ echo "baz" > bar
|
|
|
|
$ hg ci -A -m "unpushable commit" bar
|
|
|
|
$ hg push --ssh "sh ../ssh.sh"
|
2012-06-10 05:05:59 +04:00
|
|
|
pushing to ssh://user@dummy/*/remote (glob)
|
2012-05-23 02:17:37 +04:00
|
|
|
searching for changes
|
2018-05-29 21:51:12 +03:00
|
|
|
remote: Permission denied - blocked by readonlyrejectpush hook
|
2018-01-03 16:35:56 +03:00
|
|
|
remote: pretxnopen.readonlyrejectpush hook failed
|
2015-10-24 02:39:22 +03:00
|
|
|
abort: push failed on remote
|
2015-05-27 21:57:20 +03:00
|
|
|
[255]
|
2012-05-23 02:17:37 +04:00
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
2014-08-16 21:19:26 +04:00
|
|
|
stderr from remote commands should be printed before stdout from local code (issue4336)
|
|
|
|
|
|
|
|
$ hg clone remote stderr-ordering
|
|
|
|
updating to branch default
|
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ cd stderr-ordering
|
|
|
|
$ cat >> localwrite.py << EOF
|
2019-01-30 03:25:33 +03:00
|
|
|
> from edenscm.mercurial import exchange, extensions
|
2014-08-16 21:19:26 +04:00
|
|
|
>
|
|
|
|
> def wrappedpush(orig, repo, *args, **kwargs):
|
|
|
|
> res = orig(repo, *args, **kwargs)
|
|
|
|
> repo.ui.write('local stdout\n')
|
|
|
|
> return res
|
|
|
|
>
|
|
|
|
> def extsetup(ui):
|
|
|
|
> extensions.wrapfunction(exchange, 'push', wrappedpush)
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ cat >> .hg/hgrc << EOF
|
|
|
|
> [paths]
|
|
|
|
> default-push = ssh://user@dummy/remote
|
|
|
|
> [ui]
|
2017-07-07 08:05:20 +03:00
|
|
|
> ssh = "$PYTHON" "$TESTDIR/dummyssh"
|
2014-08-16 21:19:26 +04:00
|
|
|
> [extensions]
|
|
|
|
> localwrite = localwrite.py
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ echo localwrite > foo
|
|
|
|
$ hg commit -m 'testing localwrite'
|
|
|
|
$ hg push
|
|
|
|
pushing to ssh://user@dummy/remote
|
|
|
|
searching for changes
|
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
remote: KABOOM
|
2016-11-08 16:22:22 +03:00
|
|
|
remote: KABOOM IN PROCESS
|
2014-08-16 21:19:26 +04:00
|
|
|
local stdout
|
|
|
|
|
2015-05-29 10:09:36 +03:00
|
|
|
debug output
|
|
|
|
|
|
|
|
$ hg pull --debug ssh://user@dummy/remote
|
|
|
|
pulling from ssh://user@dummy/remote
|
2017-08-05 09:54:12 +03:00
|
|
|
running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
|
2015-05-29 10:09:36 +03:00
|
|
|
sending hello command
|
|
|
|
sending between command
|
2019-02-19 12:54:57 +03:00
|
|
|
remote: 413
|
|
|
|
remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash unbundlereplay batch streamreqs=generaldelta,revlogv1 stream_option $USUAL_BUNDLE2_CAPS$ unbundle=HG10GZ,HG10BZ,HG10UN
|
2015-05-29 10:09:36 +03:00
|
|
|
remote: 1
|
|
|
|
query 1; heads
|
|
|
|
sending batch command
|
|
|
|
searching for changes
|
|
|
|
all remote heads known locally
|
|
|
|
no changes found
|
2015-05-27 21:57:20 +03:00
|
|
|
sending getbundle command
|
|
|
|
bundle2-input-bundle: with-transaction
|
2017-10-17 16:27:22 +03:00
|
|
|
bundle2-input-part: "bookmarks" supported
|
|
|
|
bundle2-input-part: total payload size 26
|
2015-05-27 21:57:20 +03:00
|
|
|
bundle2-input-part: "listkeys" (params: 1 mandatory) supported
|
2015-06-01 20:28:40 +03:00
|
|
|
bundle2-input-part: total payload size 45
|
2017-09-24 22:27:18 +03:00
|
|
|
bundle2-input-part: "phase-heads" supported
|
2019-02-09 00:27:50 +03:00
|
|
|
bundle2-input-part: total payload size 48
|
2017-10-17 16:27:22 +03:00
|
|
|
bundle2-input-bundle: 2 parts total
|
2015-05-27 21:57:20 +03:00
|
|
|
checking for updated bookmarks
|
2015-05-29 10:09:36 +03:00
|
|
|
|
2014-08-16 21:19:26 +04:00
|
|
|
$ cd ..
|
|
|
|
|
2010-09-26 22:41:32 +04:00
|
|
|
$ cat dummylog
|
2011-12-08 19:39:00 +04:00
|
|
|
Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
|
2015-09-01 10:38:52 +03:00
|
|
|
Got arguments 1:user@dummy 2:hg -R $TESTTMP/nonexistent serve --stdio
|
2011-12-08 19:39:00 +04:00
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
2014-10-31 22:56:25 +03:00
|
|
|
Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio
|
2011-12-08 19:39:00 +04:00
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
2015-02-24 12:55:24 +03:00
|
|
|
Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
|
2011-12-08 19:39:00 +04:00
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R local serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
2017-03-31 12:53:56 +03:00
|
|
|
changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
|
2011-12-08 19:39:00 +04:00
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
2017-03-31 12:53:56 +03:00
|
|
|
changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
|
2011-12-08 19:39:00 +04:00
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg init 'a repo'
|
|
|
|
Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
|
|
|
|
Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
|
2012-10-19 23:47:55 +04:00
|
|
|
Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
|
2014-04-24 01:29:55 +04:00
|
|
|
Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
|
2014-08-16 21:19:26 +04:00
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
2017-03-31 12:53:56 +03:00
|
|
|
changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP
|
2015-05-29 10:09:36 +03:00
|
|
|
Got arguments 1:user@dummy 2:hg -R remote serve --stdio
|
2015-10-24 02:39:26 +03:00
|
|
|
|
|
|
|
remote hook failure is attributed to remote
|
|
|
|
|
|
|
|
$ cat > $TESTTMP/failhook << EOF
|
|
|
|
> def hook(ui, repo, **kwargs):
|
|
|
|
> ui.write('hook failure!\n')
|
|
|
|
> ui.flush()
|
|
|
|
> return 1
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
|
|
|
|
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
|
2015-10-24 02:39:26 +03:00
|
|
|
$ cd hookout
|
|
|
|
$ touch hookfailure
|
|
|
|
$ hg -q commit -A -m 'remote hook failure'
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
|
2015-10-24 02:39:26 +03:00
|
|
|
pushing to ssh://user@dummy/remote
|
|
|
|
searching for changes
|
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
|
|
|
remote: hook failure!
|
|
|
|
remote: transaction abort!
|
|
|
|
remote: rollback completed
|
2015-10-24 02:39:22 +03:00
|
|
|
remote: pretxnchangegroup.fail hook failed
|
|
|
|
abort: push failed on remote
|
2015-10-24 02:39:26 +03:00
|
|
|
[255]
|
|
|
|
|
2017-02-10 20:20:58 +03:00
|
|
|
abort during pull is properly reported as such
|
|
|
|
|
|
|
|
$ echo morefoo >> ../remote/foo
|
|
|
|
$ hg -R ../remote commit --message "more foo to be pulled"
|
|
|
|
$ cat >> ../remote/.hg/hgrc << EOF
|
|
|
|
> [extensions]
|
|
|
|
> crash = ${TESTDIR}/crashgetbundler.py
|
|
|
|
> EOF
|
2017-07-07 08:05:20 +03:00
|
|
|
$ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
|
2017-02-10 20:20:58 +03:00
|
|
|
pulling from ssh://user@dummy/remote
|
|
|
|
searching for changes
|
|
|
|
remote: abort: this is an exercise
|
|
|
|
abort: pull failed on remote
|
|
|
|
[255]
|
2017-11-20 12:40:26 +03:00
|
|
|
|
|
|
|
abort with no error hint when there is a ssh problem when pulling
|
|
|
|
|
2017-11-26 05:22:27 +03:00
|
|
|
$ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
|
2017-11-20 12:40:26 +03:00
|
|
|
pulling from ssh://brokenrepository/
|
|
|
|
abort: no suitable response from remote hg!
|
|
|
|
[255]
|
|
|
|
|
|
|
|
abort with configured error hint when there is a ssh problem when pulling
|
|
|
|
|
2017-11-26 05:22:27 +03:00
|
|
|
$ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" \
|
|
|
|
> --config ui.ssherrorhint="Please see http://company/internalwiki/ssh.html"
|
2017-11-20 12:40:26 +03:00
|
|
|
pulling from ssh://brokenrepository/
|
|
|
|
abort: no suitable response from remote hg!
|
|
|
|
(Please see http://company/internalwiki/ssh.html)
|
|
|
|
[255]
|
2017-12-14 17:31:57 +03:00
|
|
|
|
|
|
|
test that custom environment is passed down to ssh executable
|
|
|
|
$ cat >>dumpenv <<EOF
|
|
|
|
> #! /bin/sh
|
|
|
|
> echo \$VAR >&2
|
|
|
|
> EOF
|
|
|
|
$ chmod +x dumpenv
|
|
|
|
$ hg pull ssh://something --config ui.ssh="./dumpenv"
|
|
|
|
pulling from ssh://something/
|
|
|
|
remote:
|
|
|
|
abort: no suitable response from remote hg!
|
|
|
|
[255]
|
|
|
|
$ hg pull ssh://something --config ui.ssh="./dumpenv" --config sshenv.VAR=17
|
|
|
|
pulling from ssh://something/
|
|
|
|
remote: 17
|
|
|
|
abort: no suitable response from remote hg!
|
|
|
|
[255]
|
|
|
|
|