Debian Codegraph @

tests/test-pull-network.t

raw
1 #require serve
2
3 $ hg init test
4 $ cd test
5
6 $ echo foo>foo
7 $ hg addremove
8 adding foo
9 $ hg commit -m 1
10
11 $ hg verify -q
12
13 $ hg serve -p $HGPORT -d --pid-file=hg.pid
14 $ cat hg.pid >> $DAEMON_PIDS
15 $ cd ..
16
17 $ hg clone --pull http://foo:bar@localhost:$HGPORT/ copy
18 requesting all changes
19 adding changesets
20 adding manifests
21 adding file changes
22 added 1 changesets with 1 changes to 1 files
23 new changesets 340e38bdcde4
24 updating to branch default
25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
26
27 $ cd copy
28 $ hg verify -q
29
30 $ hg co
31 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 $ cat foo
33 foo
34
35 $ hg manifest --debug
36 2ed2a3912a0b24502043eae84ee4b279c18b90dd 644 foo
37
38 $ hg pull
39 pulling from http://foo@localhost:$HGPORT/
40 searching for changes
41 no changes found
42
43 $ hg rollback --dry-run --verbose
44 repository tip rolled back to revision -1 (undo pull: http://foo:***@localhost:$HGPORT/)
45
46 Test pull of non-existing 20 character revision specification, making sure plain ascii identifiers
47 not are encoded like a node:
48
49 $ hg pull -r 'xxxxxxxxxxxxxxxxxxxy'
50 pulling from http://foo@localhost:$HGPORT/
51 abort: unknown revision 'xxxxxxxxxxxxxxxxxxxy'
52 [255]
53 $ hg pull -r 'xxxxxxxxxxxxxxxxxx y'
54 pulling from http://foo@localhost:$HGPORT/
55 abort: unknown revision 'xxxxxxxxxxxxxxxxxx y'
56 [255]
57
58 Test pull of working copy revision
59 $ hg pull -r 'ffffffffffff'
60 pulling from http://foo@localhost:$HGPORT/
61 abort: unknown revision 'ffffffffffff'
62 [255]
63
64 Test 'file:' uri handling:
65
66 $ hg pull -q file://../test-does-not-exist
67 abort: file:// URLs can only refer to localhost
68 [255]
69
70 $ hg pull -q file://../test
71 abort: file:// URLs can only refer to localhost
72 [255]
73
74 MSYS changes 'file:' into 'file;'
75
76 #if no-msys
77 $ hg pull -q file:../test # no-msys
78 #endif
79
80 It's tricky to make file:// URLs working on every platform with
81 regular shell commands.
82
83 $ URL=`"$PYTHON" -c "import os; print('file://foobar' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test')"`
84 $ hg pull -q "$URL"
85 abort: file:// URLs can only refer to localhost
86 [255]
87
88 $ URL=`"$PYTHON" -c "import os; print('file://localhost' + ('/' + os.getcwd().replace(os.sep, '/')).replace('//', '/') + '/../test')"`
89 $ hg pull -q "$URL"
90
91 SEC: check for unsafe ssh url
92
93 $ cat >> $HGRCPATH << EOF
94 > [ui]
95 > ssh = sh -c "read l; read l; read l"
96 > EOF
97
98 $ hg pull 'ssh://-oProxyCommand=touch${IFS}owned/path'
99 pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
100 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
101 [255]
102 $ hg pull 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
103 pulling from ssh://-oProxyCommand%3Dtouch%24%7BIFS%7Downed/path
104 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
105 [255]
106 $ hg pull 'ssh://fakehost|touch${IFS}owned/path'
107 pulling from ssh://fakehost%7Ctouch%24%7BIFS%7Downed/path
108 abort: no suitable response from remote hg
109 [255]
110 $ hg --config ui.timestamp-output=true pull 'ssh://fakehost%7Ctouch%20owned/path'
111 \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] pulling from ssh://fakehost%7Ctouch%20owned/path (re)
112 \[20[2-9][0-9]-[01][0-9]-[0-3][0-9]T[0-5][0-9]:[0-5][0-9]:[0-5][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9]\] abort: no suitable response from remote hg (re)
113 [255]
114
115 $ [ ! -f owned ] || echo 'you got owned'
116
117 $ cd ..