##// END OF EJS Templates
pushkey: force HTTP POST on push and add tests (issue2489)
Matt Mackall -
r12969:6bd9778a stable
parent child Browse files
Show More
@@ -68,6 +68,8 b' class httprepository(wireproto.wirerepos'
68 raise util.Abort(_('operation not supported over http'))
68 raise util.Abort(_('operation not supported over http'))
69
69
70 def _callstream(self, cmd, **args):
70 def _callstream(self, cmd, **args):
71 if cmd is 'pushkey':
72 args['data'] = ''
71 data = args.pop('data', None)
73 data = args.pop('data', None)
72 headers = args.pop('headers', {})
74 headers = args.pop('headers', {})
73 self.ui.debug("sending %s command\n" % cmd)
75 self.ui.debug("sending %s command\n" % cmd)
@@ -22,6 +22,9 b' import bookmark by name'
22
22
23 $ hg init ../b
23 $ hg init ../b
24 $ cd ../b
24 $ cd ../b
25 $ hg book Y
26 $ hg book
27 * Y -1:000000000000
25 $ hg pull ../a
28 $ hg pull ../a
26 pulling from ../a
29 pulling from ../a
27 requesting all changes
30 requesting all changes
@@ -31,13 +34,21 b' import bookmark by name'
31 added 1 changesets with 1 changes to 1 files
34 added 1 changesets with 1 changes to 1 files
32 (run 'hg update' to get a working copy)
35 (run 'hg update' to get a working copy)
33 $ hg bookmarks
36 $ hg bookmarks
34 no bookmarks set
37 Y 0:4e3505fd9583
38 $ hg debugpushkey ../a namespaces
39 bookmarks
40 namespaces
41 $ hg debugpushkey ../a bookmarks
42 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
43 X 4e3505fd95835d721066b76e75dbb8cc554d7f77
44 Z 4e3505fd95835d721066b76e75dbb8cc554d7f77
35 $ hg pull -B X ../a
45 $ hg pull -B X ../a
36 pulling from ../a
46 pulling from ../a
37 searching for changes
47 searching for changes
38 no changes found
48 no changes found
39 importing bookmark X
49 importing bookmark X
40 $ hg bookmark
50 $ hg bookmark
51 Y 0:4e3505fd9583
41 X 0:4e3505fd9583
52 X 0:4e3505fd9583
42
53
43 export bookmark by name
54 export bookmark by name
@@ -56,6 +67,12 b' export bookmark by name'
56 * Z 0:4e3505fd9583
67 * Z 0:4e3505fd9583
57 W -1:000000000000
68 W -1:000000000000
58
69
70 delete a remote bookmark
71
72 $ hg book -d W
73 $ hg push -B W ../a
74 deleting remote bookmark W
75
59 push/pull name that doesn't exist
76 push/pull name that doesn't exist
60
77
61 $ hg push -B badname ../a
78 $ hg push -B badname ../a
@@ -64,3 +81,99 b" push/pull name that doesn't exist"
64 $ hg pull -B anotherbadname ../a
81 $ hg pull -B anotherbadname ../a
65 abort: remote bookmark anotherbadname not found!
82 abort: remote bookmark anotherbadname not found!
66 [255]
83 [255]
84
85 divergent bookmarks
86
87 $ cd ../a
88 $ echo c1 > f1
89 $ hg ci -Am1
90 adding f1
91 $ hg book -f X
92 $ hg book
93 Y 0:4e3505fd9583
94 * X 1:0d2164f0ce0d
95 Z 1:0d2164f0ce0d
96
97 $ cd ../b
98 $ hg up
99 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
100 $ echo c2 > f2
101 $ hg ci -Am2
102 adding f2
103 $ hg book -f X
104 $ hg book
105 Y 0:4e3505fd9583
106 * X 1:9b140be10808
107 foo -1:000000000000
108 foobar -1:000000000000
109
110 $ hg pull ../a
111 pulling from ../a
112 searching for changes
113 adding changesets
114 adding manifests
115 adding file changes
116 added 1 changesets with 1 changes to 1 files (+1 heads)
117 not updating divergent bookmark X
118 (run 'hg heads' to see heads, 'hg merge' to merge)
119 $ hg book
120 Y 0:4e3505fd9583
121 * X 1:9b140be10808
122 foo -1:000000000000
123 foobar -1:000000000000
124 $ hg push -f ../a
125 pushing to ../a
126 searching for changes
127 adding changesets
128 adding manifests
129 adding file changes
130 added 1 changesets with 1 changes to 1 files (+1 heads)
131 $ hg -R ../a book
132 Y 0:4e3505fd9583
133 * X 1:0d2164f0ce0d
134 Z 1:0d2164f0ce0d
135
136 hgweb
137
138 $ cat <<EOF > .hg/hgrc
139 > [web]
140 > push_ssl = false
141 > allow_push = *
142 > EOF
143
144 $ hg serve -p $HGPORT -d --pid-file=../hg.pid -E errors.log
145 $ cat ../hg.pid >> $DAEMON_PIDS
146 $ cd ../a
147
148 $ hg debugpushkey http://localhost:$HGPORT/ namespaces
149 bookmarks
150 namespaces
151 $ hg debugpushkey http://localhost:$HGPORT/ bookmarks
152 Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
153 X 9b140be1080824d768c5a4691a564088eede71f9
154 foo 0000000000000000000000000000000000000000
155 foobar 0000000000000000000000000000000000000000
156 $ hg out -B http://localhost:$HGPORT/
157 comparing with http://localhost:$HGPORT/
158 searching for changed bookmarks
159 Z 0d2164f0ce0d
160 $ hg push -B Z http://localhost:$HGPORT/
161 pushing to http://localhost:$HGPORT/
162 searching for changes
163 no changes found
164 exporting bookmark Z
165 $ hg book -d Z
166 $ hg in -B http://localhost:$HGPORT/
167 comparing with http://localhost:$HGPORT/
168 searching for changed bookmarks
169 Z 0d2164f0ce0d
170 foo 000000000000
171 foobar 000000000000
172 $ hg pull -B Z http://localhost:$HGPORT/
173 pulling from http://localhost:$HGPORT/
174 searching for changes
175 no changes found
176 not updating divergent bookmark X
177 importing bookmark Z
178
179 $ kill `cat ../hg.pid`
@@ -37,10 +37,16 b" creating 'remote"
37 $ echo this > foo
37 $ echo this > foo
38 $ echo this > fooO
38 $ echo this > fooO
39 $ hg ci -A -m "init" foo fooO
39 $ hg ci -A -m "init" foo fooO
40 $ echo '[server]' > .hg/hgrc
40 $ echo <<EOF > .hg/hgrc
41 $ echo 'uncompressed = True' >> .hg/hgrc
41 > [server]
42 $ echo '[hooks]' >> .hg/hgrc
42 > uncompressed = True
43 $ echo 'changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog' >> .hg/hgrc
43 >
44 > [extensions]
45 > bookmarks =
46 >
47 > [hooks]
48 > changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog
49 > EOF
44 $ cd ..
50 $ cd ..
45
51
46 repo not found error
52 repo not found error
@@ -116,6 +122,8 b' updating rc'
116 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
122 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
117 $ echo "[ui]" >> .hg/hgrc
123 $ echo "[ui]" >> .hg/hgrc
118 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
124 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
125 $ echo '[extensions]' >> .hg/hgrc
126 $ echo 'bookmarks =' >> .hg/hgrc
119
127
120 find outgoing
128 find outgoing
121
129
@@ -185,10 +193,52 b' check remote tip'
185 $ hg ci -A -m z z
193 $ hg ci -A -m z z
186 created new head
194 created new head
187
195
196 test pushkeys and bookmarks
197
198 $ cd ../local
199 $ echo '[extensions]' >> ../remote/.hg/hgrc
200 $ echo 'bookmarks =' >> ../remote/.hg/hgrc
201 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces
202 bookmarks
203 namespaces
204 $ hg book foo -r 0
205 $ hg out -B
206 comparing with ssh://user@dummy/remote
207 searching for changed bookmarks
208 foo 1160648e36ce
209 $ hg push -B foo
210 pushing to ssh://user@dummy/remote
211 searching for changes
212 no changes found
213 exporting bookmark foo
214 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks
215 foo 1160648e36cec0054048a7edc4110c6f84fde594
216 $ hg book -f foo
217 $ hg push
218 pushing to ssh://user@dummy/remote
219 searching for changes
220 no changes found
221 updating bookmark foo
222 $ hg book -d foo
223 $ hg in -B
224 comparing with ssh://user@dummy/remote
225 searching for changed bookmarks
226 foo a28a9d1a809c
227 $ hg book -f -r 0 foo
228 $ hg pull -B foo
229 pulling from ssh://user@dummy/remote
230 searching for changes
231 no changes found
232 updating bookmark foo
233 importing bookmark foo
234 $ hg book -d foo
235 $ hg push -B foo
236 deleting remote bookmark foo
237
188 a bad, evil hook that prints to stdout
238 a bad, evil hook that prints to stdout
189
239
190 $ echo 'changegroup.stdout = python ../badhook' >> .hg/hgrc
240 $ echo '[hooks]' >> ../remote/.hg/hgrc
191 $ cd ../local
241 $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc
192 $ echo r > r
242 $ echo r > r
193 $ hg ci -A -m z r
243 $ hg ci -A -m z r
194
244
@@ -228,6 +278,14 b' push should succeed even though it has a'
228 Got arguments 1:user@dummy 2:hg -R local serve --stdio
278 Got arguments 1:user@dummy 2:hg -R local serve --stdio
229 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
279 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
230 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
280 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
231 changegroup-in-remote hook: HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
281 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
282 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
283 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
284 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
285 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
232 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
286 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
233 changegroup-in-remote hook: HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
287 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
288 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
289 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
290 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
291 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
General Comments 0
You need to be logged in to leave comments. Login now