##// END OF EJS Templates
tests: use printenv.py where it is - don't copy it around
Mads Kiilerich -
r13405:682edefe default
parent child Browse files
Show More
@@ -1,48 +1,45 b''
1 # simple script to be used in hooks
1 # simple script to be used in hooks
2 # copy it to the current directory when the test starts:
3 #
4 # cp "$TESTDIR"/printenv.py .
5 #
2 #
6 # put something like this in the repo .hg/hgrc:
3 # put something like this in the repo .hg/hgrc:
7 #
4 #
8 # [hooks]
5 # [hooks]
9 # changegroup = python ../printenv.py <hookname> [exit] [output]
6 # changegroup = python "$TESTDIR"/printenv.py <hookname> [exit] [output]
10 #
7 #
11 # - <hookname> is a mandatory argument (e.g. "changegroup")
8 # - <hookname> is a mandatory argument (e.g. "changegroup")
12 # - [exit] is the exit code of the hook (default: 0)
9 # - [exit] is the exit code of the hook (default: 0)
13 # - [output] is the name of the output file (default: use sys.stdout)
10 # - [output] is the name of the output file (default: use sys.stdout)
14 # the file will be opened in append mode.
11 # the file will be opened in append mode.
15 #
12 #
16 import os
13 import os
17 import sys
14 import sys
18
15
19 try:
16 try:
20 import msvcrt
17 import msvcrt
21 msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
18 msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
22 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
19 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
23 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
20 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
24 except ImportError:
21 except ImportError:
25 pass
22 pass
26
23
27 exitcode = 0
24 exitcode = 0
28 out = sys.stdout
25 out = sys.stdout
29
26
30 name = sys.argv[1]
27 name = sys.argv[1]
31 if len(sys.argv) > 2:
28 if len(sys.argv) > 2:
32 exitcode = int(sys.argv[2])
29 exitcode = int(sys.argv[2])
33 if len(sys.argv) > 3:
30 if len(sys.argv) > 3:
34 out = open(sys.argv[3], "ab")
31 out = open(sys.argv[3], "ab")
35
32
36 # variables with empty values may not exist on all platforms, filter
33 # variables with empty values may not exist on all platforms, filter
37 # them now for portability sake.
34 # them now for portability sake.
38 env = [k for k, v in os.environ.iteritems()
35 env = [k for k, v in os.environ.iteritems()
39 if k.startswith("HG_") and v]
36 if k.startswith("HG_") and v]
40 env.sort()
37 env.sort()
41
38
42 out.write("%s hook: " % name)
39 out.write("%s hook: " % name)
43 for v in env:
40 for v in env:
44 out.write("%s=%s " % (v, os.environ[v]))
41 out.write("%s=%s " % (v, os.environ[v]))
45 out.write("\n")
42 out.write("\n")
46 out.close()
43 out.close()
47
44
48 sys.exit(exitcode)
45 sys.exit(exitcode)
@@ -1,575 +1,573 b''
1 $ cp "$TESTDIR"/printenv.py .
2
3 Setting up test
1 Setting up test
4
2
5 $ hg init test
3 $ hg init test
6 $ cd test
4 $ cd test
7 $ echo 0 > afile
5 $ echo 0 > afile
8 $ hg add afile
6 $ hg add afile
9 $ hg commit -m "0.0"
7 $ hg commit -m "0.0"
10 $ echo 1 >> afile
8 $ echo 1 >> afile
11 $ hg commit -m "0.1"
9 $ hg commit -m "0.1"
12 $ echo 2 >> afile
10 $ echo 2 >> afile
13 $ hg commit -m "0.2"
11 $ hg commit -m "0.2"
14 $ echo 3 >> afile
12 $ echo 3 >> afile
15 $ hg commit -m "0.3"
13 $ hg commit -m "0.3"
16 $ hg update -C 0
14 $ hg update -C 0
17 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
15 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
18 $ echo 1 >> afile
16 $ echo 1 >> afile
19 $ hg commit -m "1.1"
17 $ hg commit -m "1.1"
20 created new head
18 created new head
21 $ echo 2 >> afile
19 $ echo 2 >> afile
22 $ hg commit -m "1.2"
20 $ hg commit -m "1.2"
23 $ echo "a line" > fred
21 $ echo "a line" > fred
24 $ echo 3 >> afile
22 $ echo 3 >> afile
25 $ hg add fred
23 $ hg add fred
26 $ hg commit -m "1.3"
24 $ hg commit -m "1.3"
27 $ hg mv afile adifferentfile
25 $ hg mv afile adifferentfile
28 $ hg commit -m "1.3m"
26 $ hg commit -m "1.3m"
29 $ hg update -C 3
27 $ hg update -C 3
30 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
28 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
31 $ hg mv afile anotherfile
29 $ hg mv afile anotherfile
32 $ hg commit -m "0.3m"
30 $ hg commit -m "0.3m"
33 $ hg verify
31 $ hg verify
34 checking changesets
32 checking changesets
35 checking manifests
33 checking manifests
36 crosschecking files in changesets and manifests
34 crosschecking files in changesets and manifests
37 checking files
35 checking files
38 4 files, 9 changesets, 7 total revisions
36 4 files, 9 changesets, 7 total revisions
39 $ cd ..
37 $ cd ..
40 $ hg init empty
38 $ hg init empty
41
39
42 Bundle --all
40 Bundle --all
43
41
44 $ hg -R test bundle --all all.hg
42 $ hg -R test bundle --all all.hg
45 9 changesets found
43 9 changesets found
46
44
47 Bundle test to full.hg
45 Bundle test to full.hg
48
46
49 $ hg -R test bundle full.hg empty
47 $ hg -R test bundle full.hg empty
50 searching for changes
48 searching for changes
51 9 changesets found
49 9 changesets found
52
50
53 Unbundle full.hg in test
51 Unbundle full.hg in test
54
52
55 $ hg -R test unbundle full.hg
53 $ hg -R test unbundle full.hg
56 adding changesets
54 adding changesets
57 adding manifests
55 adding manifests
58 adding file changes
56 adding file changes
59 added 0 changesets with 0 changes to 4 files
57 added 0 changesets with 0 changes to 4 files
60 (run 'hg update' to get a working copy)
58 (run 'hg update' to get a working copy)
61
59
62 Verify empty
60 Verify empty
63
61
64 $ hg -R empty heads
62 $ hg -R empty heads
65 [1]
63 [1]
66 $ hg -R empty verify
64 $ hg -R empty verify
67 checking changesets
65 checking changesets
68 checking manifests
66 checking manifests
69 crosschecking files in changesets and manifests
67 crosschecking files in changesets and manifests
70 checking files
68 checking files
71 0 files, 0 changesets, 0 total revisions
69 0 files, 0 changesets, 0 total revisions
72
70
73 Pull full.hg into test (using --cwd)
71 Pull full.hg into test (using --cwd)
74
72
75 $ hg --cwd test pull ../full.hg
73 $ hg --cwd test pull ../full.hg
76 pulling from ../full.hg
74 pulling from ../full.hg
77 searching for changes
75 searching for changes
78 no changes found
76 no changes found
79
77
80 Pull full.hg into empty (using --cwd)
78 Pull full.hg into empty (using --cwd)
81
79
82 $ hg --cwd empty pull ../full.hg
80 $ hg --cwd empty pull ../full.hg
83 pulling from ../full.hg
81 pulling from ../full.hg
84 requesting all changes
82 requesting all changes
85 adding changesets
83 adding changesets
86 adding manifests
84 adding manifests
87 adding file changes
85 adding file changes
88 added 9 changesets with 7 changes to 4 files (+1 heads)
86 added 9 changesets with 7 changes to 4 files (+1 heads)
89 (run 'hg heads' to see heads, 'hg merge' to merge)
87 (run 'hg heads' to see heads, 'hg merge' to merge)
90
88
91 Rollback empty
89 Rollback empty
92
90
93 $ hg -R empty rollback
91 $ hg -R empty rollback
94 rolling back to revision -1 (undo pull)
92 rolling back to revision -1 (undo pull)
95
93
96 Pull full.hg into empty again (using --cwd)
94 Pull full.hg into empty again (using --cwd)
97
95
98 $ hg --cwd empty pull ../full.hg
96 $ hg --cwd empty pull ../full.hg
99 pulling from ../full.hg
97 pulling from ../full.hg
100 requesting all changes
98 requesting all changes
101 adding changesets
99 adding changesets
102 adding manifests
100 adding manifests
103 adding file changes
101 adding file changes
104 added 9 changesets with 7 changes to 4 files (+1 heads)
102 added 9 changesets with 7 changes to 4 files (+1 heads)
105 (run 'hg heads' to see heads, 'hg merge' to merge)
103 (run 'hg heads' to see heads, 'hg merge' to merge)
106
104
107 Pull full.hg into test (using -R)
105 Pull full.hg into test (using -R)
108
106
109 $ hg -R test pull full.hg
107 $ hg -R test pull full.hg
110 pulling from full.hg
108 pulling from full.hg
111 searching for changes
109 searching for changes
112 no changes found
110 no changes found
113
111
114 Pull full.hg into empty (using -R)
112 Pull full.hg into empty (using -R)
115
113
116 $ hg -R empty pull full.hg
114 $ hg -R empty pull full.hg
117 pulling from full.hg
115 pulling from full.hg
118 searching for changes
116 searching for changes
119 no changes found
117 no changes found
120
118
121 Rollback empty
119 Rollback empty
122
120
123 $ hg -R empty rollback
121 $ hg -R empty rollback
124 rolling back to revision -1 (undo pull)
122 rolling back to revision -1 (undo pull)
125
123
126 Pull full.hg into empty again (using -R)
124 Pull full.hg into empty again (using -R)
127
125
128 $ hg -R empty pull full.hg
126 $ hg -R empty pull full.hg
129 pulling from full.hg
127 pulling from full.hg
130 requesting all changes
128 requesting all changes
131 adding changesets
129 adding changesets
132 adding manifests
130 adding manifests
133 adding file changes
131 adding file changes
134 added 9 changesets with 7 changes to 4 files (+1 heads)
132 added 9 changesets with 7 changes to 4 files (+1 heads)
135 (run 'hg heads' to see heads, 'hg merge' to merge)
133 (run 'hg heads' to see heads, 'hg merge' to merge)
136
134
137 Log -R full.hg in fresh empty
135 Log -R full.hg in fresh empty
138
136
139 $ rm -r empty
137 $ rm -r empty
140 $ hg init empty
138 $ hg init empty
141 $ cd empty
139 $ cd empty
142 $ hg -R bundle://../full.hg log
140 $ hg -R bundle://../full.hg log
143 changeset: 8:aa35859c02ea
141 changeset: 8:aa35859c02ea
144 tag: tip
142 tag: tip
145 parent: 3:eebf5a27f8ca
143 parent: 3:eebf5a27f8ca
146 user: test
144 user: test
147 date: Thu Jan 01 00:00:00 1970 +0000
145 date: Thu Jan 01 00:00:00 1970 +0000
148 summary: 0.3m
146 summary: 0.3m
149
147
150 changeset: 7:a6a34bfa0076
148 changeset: 7:a6a34bfa0076
151 user: test
149 user: test
152 date: Thu Jan 01 00:00:00 1970 +0000
150 date: Thu Jan 01 00:00:00 1970 +0000
153 summary: 1.3m
151 summary: 1.3m
154
152
155 changeset: 6:7373c1169842
153 changeset: 6:7373c1169842
156 user: test
154 user: test
157 date: Thu Jan 01 00:00:00 1970 +0000
155 date: Thu Jan 01 00:00:00 1970 +0000
158 summary: 1.3
156 summary: 1.3
159
157
160 changeset: 5:1bb50a9436a7
158 changeset: 5:1bb50a9436a7
161 user: test
159 user: test
162 date: Thu Jan 01 00:00:00 1970 +0000
160 date: Thu Jan 01 00:00:00 1970 +0000
163 summary: 1.2
161 summary: 1.2
164
162
165 changeset: 4:095197eb4973
163 changeset: 4:095197eb4973
166 parent: 0:f9ee2f85a263
164 parent: 0:f9ee2f85a263
167 user: test
165 user: test
168 date: Thu Jan 01 00:00:00 1970 +0000
166 date: Thu Jan 01 00:00:00 1970 +0000
169 summary: 1.1
167 summary: 1.1
170
168
171 changeset: 3:eebf5a27f8ca
169 changeset: 3:eebf5a27f8ca
172 user: test
170 user: test
173 date: Thu Jan 01 00:00:00 1970 +0000
171 date: Thu Jan 01 00:00:00 1970 +0000
174 summary: 0.3
172 summary: 0.3
175
173
176 changeset: 2:e38ba6f5b7e0
174 changeset: 2:e38ba6f5b7e0
177 user: test
175 user: test
178 date: Thu Jan 01 00:00:00 1970 +0000
176 date: Thu Jan 01 00:00:00 1970 +0000
179 summary: 0.2
177 summary: 0.2
180
178
181 changeset: 1:34c2bf6b0626
179 changeset: 1:34c2bf6b0626
182 user: test
180 user: test
183 date: Thu Jan 01 00:00:00 1970 +0000
181 date: Thu Jan 01 00:00:00 1970 +0000
184 summary: 0.1
182 summary: 0.1
185
183
186 changeset: 0:f9ee2f85a263
184 changeset: 0:f9ee2f85a263
187 user: test
185 user: test
188 date: Thu Jan 01 00:00:00 1970 +0000
186 date: Thu Jan 01 00:00:00 1970 +0000
189 summary: 0.0
187 summary: 0.0
190
188
191 Make sure bundlerepo doesn't leak tempfiles (issue2491)
189 Make sure bundlerepo doesn't leak tempfiles (issue2491)
192
190
193 $ ls .hg
191 $ ls .hg
194 00changelog.i
192 00changelog.i
195 cache
193 cache
196 requires
194 requires
197 store
195 store
198
196
199 Pull ../full.hg into empty (with hook)
197 Pull ../full.hg into empty (with hook)
200
198
201 $ echo '[hooks]' >> .hg/hgrc
199 $ echo '[hooks]' >> .hg/hgrc
202 $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
200 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc
203
201
204 doesn't work (yet ?)
202 doesn't work (yet ?)
205
203
206 hg -R bundle://../full.hg verify
204 hg -R bundle://../full.hg verify
207
205
208 $ hg pull bundle://../full.hg
206 $ hg pull bundle://../full.hg
209 changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_URL=bundle:../full.hg
207 changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_URL=bundle:../full.hg
210 pulling from bundle://../full.hg
208 pulling from bundle://../full.hg
211 requesting all changes
209 requesting all changes
212 adding changesets
210 adding changesets
213 adding manifests
211 adding manifests
214 adding file changes
212 adding file changes
215 added 9 changesets with 7 changes to 4 files (+1 heads)
213 added 9 changesets with 7 changes to 4 files (+1 heads)
216 (run 'hg heads' to see heads, 'hg merge' to merge)
214 (run 'hg heads' to see heads, 'hg merge' to merge)
217
215
218 Rollback empty
216 Rollback empty
219
217
220 $ hg rollback
218 $ hg rollback
221 rolling back to revision -1 (undo pull)
219 rolling back to revision -1 (undo pull)
222 $ cd ..
220 $ cd ..
223
221
224 Log -R bundle:empty+full.hg
222 Log -R bundle:empty+full.hg
225
223
226 $ hg -R bundle:empty+full.hg log --template="{rev} "; echo ""
224 $ hg -R bundle:empty+full.hg log --template="{rev} "; echo ""
227 8 7 6 5 4 3 2 1 0
225 8 7 6 5 4 3 2 1 0
228
226
229 Pull full.hg into empty again (using -R; with hook)
227 Pull full.hg into empty again (using -R; with hook)
230
228
231 $ hg -R empty pull full.hg
229 $ hg -R empty pull full.hg
232 changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_URL=bundle:empty+full.hg
230 changegroup hook: HG_NODE=f9ee2f85a263049e9ae6d37a0e67e96194ffb735 HG_SOURCE=pull HG_URL=bundle:empty+full.hg
233 pulling from full.hg
231 pulling from full.hg
234 requesting all changes
232 requesting all changes
235 adding changesets
233 adding changesets
236 adding manifests
234 adding manifests
237 adding file changes
235 adding file changes
238 added 9 changesets with 7 changes to 4 files (+1 heads)
236 added 9 changesets with 7 changes to 4 files (+1 heads)
239 (run 'hg heads' to see heads, 'hg merge' to merge)
237 (run 'hg heads' to see heads, 'hg merge' to merge)
240
238
241 Create partial clones
239 Create partial clones
242
240
243 $ rm -r empty
241 $ rm -r empty
244 $ hg init empty
242 $ hg init empty
245 $ hg clone -r 3 test partial
243 $ hg clone -r 3 test partial
246 adding changesets
244 adding changesets
247 adding manifests
245 adding manifests
248 adding file changes
246 adding file changes
249 added 4 changesets with 4 changes to 1 files
247 added 4 changesets with 4 changes to 1 files
250 updating to branch default
248 updating to branch default
251 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 $ hg clone partial partial2
250 $ hg clone partial partial2
253 updating to branch default
251 updating to branch default
254 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
252 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
255 $ cd partial
253 $ cd partial
256
254
257 Log -R full.hg in partial
255 Log -R full.hg in partial
258
256
259 $ hg -R bundle://../full.hg log
257 $ hg -R bundle://../full.hg log
260 changeset: 8:aa35859c02ea
258 changeset: 8:aa35859c02ea
261 tag: tip
259 tag: tip
262 parent: 3:eebf5a27f8ca
260 parent: 3:eebf5a27f8ca
263 user: test
261 user: test
264 date: Thu Jan 01 00:00:00 1970 +0000
262 date: Thu Jan 01 00:00:00 1970 +0000
265 summary: 0.3m
263 summary: 0.3m
266
264
267 changeset: 7:a6a34bfa0076
265 changeset: 7:a6a34bfa0076
268 user: test
266 user: test
269 date: Thu Jan 01 00:00:00 1970 +0000
267 date: Thu Jan 01 00:00:00 1970 +0000
270 summary: 1.3m
268 summary: 1.3m
271
269
272 changeset: 6:7373c1169842
270 changeset: 6:7373c1169842
273 user: test
271 user: test
274 date: Thu Jan 01 00:00:00 1970 +0000
272 date: Thu Jan 01 00:00:00 1970 +0000
275 summary: 1.3
273 summary: 1.3
276
274
277 changeset: 5:1bb50a9436a7
275 changeset: 5:1bb50a9436a7
278 user: test
276 user: test
279 date: Thu Jan 01 00:00:00 1970 +0000
277 date: Thu Jan 01 00:00:00 1970 +0000
280 summary: 1.2
278 summary: 1.2
281
279
282 changeset: 4:095197eb4973
280 changeset: 4:095197eb4973
283 parent: 0:f9ee2f85a263
281 parent: 0:f9ee2f85a263
284 user: test
282 user: test
285 date: Thu Jan 01 00:00:00 1970 +0000
283 date: Thu Jan 01 00:00:00 1970 +0000
286 summary: 1.1
284 summary: 1.1
287
285
288 changeset: 3:eebf5a27f8ca
286 changeset: 3:eebf5a27f8ca
289 user: test
287 user: test
290 date: Thu Jan 01 00:00:00 1970 +0000
288 date: Thu Jan 01 00:00:00 1970 +0000
291 summary: 0.3
289 summary: 0.3
292
290
293 changeset: 2:e38ba6f5b7e0
291 changeset: 2:e38ba6f5b7e0
294 user: test
292 user: test
295 date: Thu Jan 01 00:00:00 1970 +0000
293 date: Thu Jan 01 00:00:00 1970 +0000
296 summary: 0.2
294 summary: 0.2
297
295
298 changeset: 1:34c2bf6b0626
296 changeset: 1:34c2bf6b0626
299 user: test
297 user: test
300 date: Thu Jan 01 00:00:00 1970 +0000
298 date: Thu Jan 01 00:00:00 1970 +0000
301 summary: 0.1
299 summary: 0.1
302
300
303 changeset: 0:f9ee2f85a263
301 changeset: 0:f9ee2f85a263
304 user: test
302 user: test
305 date: Thu Jan 01 00:00:00 1970 +0000
303 date: Thu Jan 01 00:00:00 1970 +0000
306 summary: 0.0
304 summary: 0.0
307
305
308
306
309 Incoming full.hg in partial
307 Incoming full.hg in partial
310
308
311 $ hg incoming bundle://../full.hg
309 $ hg incoming bundle://../full.hg
312 comparing with bundle://../full.hg
310 comparing with bundle://../full.hg
313 searching for changes
311 searching for changes
314 changeset: 4:095197eb4973
312 changeset: 4:095197eb4973
315 parent: 0:f9ee2f85a263
313 parent: 0:f9ee2f85a263
316 user: test
314 user: test
317 date: Thu Jan 01 00:00:00 1970 +0000
315 date: Thu Jan 01 00:00:00 1970 +0000
318 summary: 1.1
316 summary: 1.1
319
317
320 changeset: 5:1bb50a9436a7
318 changeset: 5:1bb50a9436a7
321 user: test
319 user: test
322 date: Thu Jan 01 00:00:00 1970 +0000
320 date: Thu Jan 01 00:00:00 1970 +0000
323 summary: 1.2
321 summary: 1.2
324
322
325 changeset: 6:7373c1169842
323 changeset: 6:7373c1169842
326 user: test
324 user: test
327 date: Thu Jan 01 00:00:00 1970 +0000
325 date: Thu Jan 01 00:00:00 1970 +0000
328 summary: 1.3
326 summary: 1.3
329
327
330 changeset: 7:a6a34bfa0076
328 changeset: 7:a6a34bfa0076
331 user: test
329 user: test
332 date: Thu Jan 01 00:00:00 1970 +0000
330 date: Thu Jan 01 00:00:00 1970 +0000
333 summary: 1.3m
331 summary: 1.3m
334
332
335 changeset: 8:aa35859c02ea
333 changeset: 8:aa35859c02ea
336 tag: tip
334 tag: tip
337 parent: 3:eebf5a27f8ca
335 parent: 3:eebf5a27f8ca
338 user: test
336 user: test
339 date: Thu Jan 01 00:00:00 1970 +0000
337 date: Thu Jan 01 00:00:00 1970 +0000
340 summary: 0.3m
338 summary: 0.3m
341
339
342
340
343 Outgoing -R full.hg vs partial2 in partial
341 Outgoing -R full.hg vs partial2 in partial
344
342
345 $ hg -R bundle://../full.hg outgoing ../partial2
343 $ hg -R bundle://../full.hg outgoing ../partial2
346 comparing with ../partial2
344 comparing with ../partial2
347 searching for changes
345 searching for changes
348 changeset: 4:095197eb4973
346 changeset: 4:095197eb4973
349 parent: 0:f9ee2f85a263
347 parent: 0:f9ee2f85a263
350 user: test
348 user: test
351 date: Thu Jan 01 00:00:00 1970 +0000
349 date: Thu Jan 01 00:00:00 1970 +0000
352 summary: 1.1
350 summary: 1.1
353
351
354 changeset: 5:1bb50a9436a7
352 changeset: 5:1bb50a9436a7
355 user: test
353 user: test
356 date: Thu Jan 01 00:00:00 1970 +0000
354 date: Thu Jan 01 00:00:00 1970 +0000
357 summary: 1.2
355 summary: 1.2
358
356
359 changeset: 6:7373c1169842
357 changeset: 6:7373c1169842
360 user: test
358 user: test
361 date: Thu Jan 01 00:00:00 1970 +0000
359 date: Thu Jan 01 00:00:00 1970 +0000
362 summary: 1.3
360 summary: 1.3
363
361
364 changeset: 7:a6a34bfa0076
362 changeset: 7:a6a34bfa0076
365 user: test
363 user: test
366 date: Thu Jan 01 00:00:00 1970 +0000
364 date: Thu Jan 01 00:00:00 1970 +0000
367 summary: 1.3m
365 summary: 1.3m
368
366
369 changeset: 8:aa35859c02ea
367 changeset: 8:aa35859c02ea
370 tag: tip
368 tag: tip
371 parent: 3:eebf5a27f8ca
369 parent: 3:eebf5a27f8ca
372 user: test
370 user: test
373 date: Thu Jan 01 00:00:00 1970 +0000
371 date: Thu Jan 01 00:00:00 1970 +0000
374 summary: 0.3m
372 summary: 0.3m
375
373
376
374
377 Outgoing -R does-not-exist.hg vs partial2 in partial
375 Outgoing -R does-not-exist.hg vs partial2 in partial
378
376
379 $ hg -R bundle://../does-not-exist.hg outgoing ../partial2
377 $ hg -R bundle://../does-not-exist.hg outgoing ../partial2
380 abort: No such file or directory: ../does-not-exist.hg
378 abort: No such file or directory: ../does-not-exist.hg
381 [255]
379 [255]
382 $ cd ..
380 $ cd ..
383
381
384 Direct clone from bundle (all-history)
382 Direct clone from bundle (all-history)
385
383
386 $ hg clone full.hg full-clone
384 $ hg clone full.hg full-clone
387 requesting all changes
385 requesting all changes
388 adding changesets
386 adding changesets
389 adding manifests
387 adding manifests
390 adding file changes
388 adding file changes
391 added 9 changesets with 7 changes to 4 files (+1 heads)
389 added 9 changesets with 7 changes to 4 files (+1 heads)
392 updating to branch default
390 updating to branch default
393 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
391 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
394 $ hg -R full-clone heads
392 $ hg -R full-clone heads
395 changeset: 8:aa35859c02ea
393 changeset: 8:aa35859c02ea
396 tag: tip
394 tag: tip
397 parent: 3:eebf5a27f8ca
395 parent: 3:eebf5a27f8ca
398 user: test
396 user: test
399 date: Thu Jan 01 00:00:00 1970 +0000
397 date: Thu Jan 01 00:00:00 1970 +0000
400 summary: 0.3m
398 summary: 0.3m
401
399
402 changeset: 7:a6a34bfa0076
400 changeset: 7:a6a34bfa0076
403 user: test
401 user: test
404 date: Thu Jan 01 00:00:00 1970 +0000
402 date: Thu Jan 01 00:00:00 1970 +0000
405 summary: 1.3m
403 summary: 1.3m
406
404
407 $ rm -r full-clone
405 $ rm -r full-clone
408
406
409 When cloning from a non-copiable repository into '', do not
407 When cloning from a non-copiable repository into '', do not
410 recurse infinitely (issue 2528)
408 recurse infinitely (issue 2528)
411
409
412 $ hg clone full.hg ''
410 $ hg clone full.hg ''
413 abort: No such file or directory
411 abort: No such file or directory
414 [255]
412 [255]
415
413
416 test for http://mercurial.selenic.com/bts/issue216
414 test for http://mercurial.selenic.com/bts/issue216
417
415
418 Unbundle incremental bundles into fresh empty in one go
416 Unbundle incremental bundles into fresh empty in one go
419
417
420 $ rm -r empty
418 $ rm -r empty
421 $ hg init empty
419 $ hg init empty
422 $ hg -R test bundle --base null -r 0 ../0.hg
420 $ hg -R test bundle --base null -r 0 ../0.hg
423 1 changesets found
421 1 changesets found
424 $ hg -R test bundle --base 0 -r 1 ../1.hg
422 $ hg -R test bundle --base 0 -r 1 ../1.hg
425 1 changesets found
423 1 changesets found
426 $ hg -R empty unbundle -u ../0.hg ../1.hg
424 $ hg -R empty unbundle -u ../0.hg ../1.hg
427 adding changesets
425 adding changesets
428 adding manifests
426 adding manifests
429 adding file changes
427 adding file changes
430 added 1 changesets with 1 changes to 1 files
428 added 1 changesets with 1 changes to 1 files
431 adding changesets
429 adding changesets
432 adding manifests
430 adding manifests
433 adding file changes
431 adding file changes
434 added 1 changesets with 1 changes to 1 files
432 added 1 changesets with 1 changes to 1 files
435 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
433 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
436
434
437 test for 540d1059c802
435 test for 540d1059c802
438
436
439 test for 540d1059c802
437 test for 540d1059c802
440
438
441 $ hg init orig
439 $ hg init orig
442 $ cd orig
440 $ cd orig
443 $ echo foo > foo
441 $ echo foo > foo
444 $ hg add foo
442 $ hg add foo
445 $ hg ci -m 'add foo'
443 $ hg ci -m 'add foo'
446
444
447 $ hg clone . ../copy
445 $ hg clone . ../copy
448 updating to branch default
446 updating to branch default
449 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
447 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
450 $ hg tag foo
448 $ hg tag foo
451
449
452 $ cd ../copy
450 $ cd ../copy
453 $ echo >> foo
451 $ echo >> foo
454 $ hg ci -m 'change foo'
452 $ hg ci -m 'change foo'
455 $ hg bundle ../bundle.hg ../orig
453 $ hg bundle ../bundle.hg ../orig
456 searching for changes
454 searching for changes
457 1 changesets found
455 1 changesets found
458
456
459 $ cd ../orig
457 $ cd ../orig
460 $ hg incoming ../bundle.hg
458 $ hg incoming ../bundle.hg
461 comparing with ../bundle.hg
459 comparing with ../bundle.hg
462 searching for changes
460 searching for changes
463 changeset: 2:ed1b79f46b9a
461 changeset: 2:ed1b79f46b9a
464 tag: tip
462 tag: tip
465 parent: 0:bbd179dfa0a7
463 parent: 0:bbd179dfa0a7
466 user: test
464 user: test
467 date: Thu Jan 01 00:00:00 1970 +0000
465 date: Thu Jan 01 00:00:00 1970 +0000
468 summary: change foo
466 summary: change foo
469
467
470 $ cd ..
468 $ cd ..
471
469
472 test for http://mercurial.selenic.com/bts/issue1144
470 test for http://mercurial.selenic.com/bts/issue1144
473
471
474 test that verify bundle does not traceback
472 test that verify bundle does not traceback
475
473
476 partial history bundle, fails w/ unkown parent
474 partial history bundle, fails w/ unkown parent
477
475
478 $ hg -R bundle.hg verify
476 $ hg -R bundle.hg verify
479 abort: 00changelog.i@bbd179dfa0a7: unknown parent!
477 abort: 00changelog.i@bbd179dfa0a7: unknown parent!
480 [255]
478 [255]
481
479
482 full history bundle, refuses to verify non-local repo
480 full history bundle, refuses to verify non-local repo
483
481
484 $ hg -R all.hg verify
482 $ hg -R all.hg verify
485 abort: cannot verify bundle or remote repos
483 abort: cannot verify bundle or remote repos
486 [255]
484 [255]
487
485
488 but, regular verify must continue to work
486 but, regular verify must continue to work
489
487
490 $ hg -R orig verify
488 $ hg -R orig verify
491 checking changesets
489 checking changesets
492 checking manifests
490 checking manifests
493 crosschecking files in changesets and manifests
491 crosschecking files in changesets and manifests
494 checking files
492 checking files
495 2 files, 2 changesets, 2 total revisions
493 2 files, 2 changesets, 2 total revisions
496
494
497 diff against bundle
495 diff against bundle
498
496
499 $ hg init b
497 $ hg init b
500 $ cd b
498 $ cd b
501 $ hg -R ../all.hg diff -r tip
499 $ hg -R ../all.hg diff -r tip
502 diff -r aa35859c02ea anotherfile
500 diff -r aa35859c02ea anotherfile
503 --- a/anotherfile Thu Jan 01 00:00:00 1970 +0000
501 --- a/anotherfile Thu Jan 01 00:00:00 1970 +0000
504 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
502 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
505 @@ -1,4 +0,0 @@
503 @@ -1,4 +0,0 @@
506 -0
504 -0
507 -1
505 -1
508 -2
506 -2
509 -3
507 -3
510 $ cd ..
508 $ cd ..
511
509
512 bundle single branch
510 bundle single branch
513
511
514 $ hg init branchy
512 $ hg init branchy
515 $ cd branchy
513 $ cd branchy
516 $ echo a >a
514 $ echo a >a
517 $ hg ci -Ama
515 $ hg ci -Ama
518 adding a
516 adding a
519 $ echo b >b
517 $ echo b >b
520 $ hg ci -Amb
518 $ hg ci -Amb
521 adding b
519 adding b
522 $ echo b1 >b1
520 $ echo b1 >b1
523 $ hg ci -Amb1
521 $ hg ci -Amb1
524 adding b1
522 adding b1
525 $ hg up 0
523 $ hg up 0
526 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
524 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
527 $ echo c >c
525 $ echo c >c
528 $ hg ci -Amc
526 $ hg ci -Amc
529 adding c
527 adding c
530 created new head
528 created new head
531 $ echo c1 >c1
529 $ echo c1 >c1
532 $ hg ci -Amc1
530 $ hg ci -Amc1
533 adding c1
531 adding c1
534 $ hg clone -q .#tip part
532 $ hg clone -q .#tip part
535
533
536 == bundling via incoming
534 == bundling via incoming
537
535
538 $ hg in -R part --bundle incoming.hg --template "{node}\n" .
536 $ hg in -R part --bundle incoming.hg --template "{node}\n" .
539 comparing with .
537 comparing with .
540 searching for changes
538 searching for changes
541 d2ae7f538514cd87c17547b0de4cea71fe1af9fb
539 d2ae7f538514cd87c17547b0de4cea71fe1af9fb
542 5ece8e77363e2b5269e27c66828b72da29e4341a
540 5ece8e77363e2b5269e27c66828b72da29e4341a
543
541
544 == bundling
542 == bundling
545
543
546 $ hg bundle bundle.hg part --debug
544 $ hg bundle bundle.hg part --debug
547 searching for changes
545 searching for changes
548 common changesets up to c0025332f9ed
546 common changesets up to c0025332f9ed
549 2 changesets found
547 2 changesets found
550 list of changesets:
548 list of changesets:
551 d2ae7f538514cd87c17547b0de4cea71fe1af9fb
549 d2ae7f538514cd87c17547b0de4cea71fe1af9fb
552 5ece8e77363e2b5269e27c66828b72da29e4341a
550 5ece8e77363e2b5269e27c66828b72da29e4341a
553 bundling: 0 changesets
551 bundling: 0 changesets
554 bundling: 0 changesets
552 bundling: 0 changesets
555 bundling: 0 changesets
553 bundling: 0 changesets
556 bundling: 1 changesets
554 bundling: 1 changesets
557 bundling: 1 changesets
555 bundling: 1 changesets
558 bundling: 1 changesets
556 bundling: 1 changesets
559 bundling: 2 changesets
557 bundling: 2 changesets
560 bundling: 0/2 manifests (0.00%)
558 bundling: 0/2 manifests (0.00%)
561 bundling: 0/2 manifests (0.00%)
559 bundling: 0/2 manifests (0.00%)
562 bundling: 0/2 manifests (0.00%)
560 bundling: 0/2 manifests (0.00%)
563 bundling: 1/2 manifests (50.00%)
561 bundling: 1/2 manifests (50.00%)
564 bundling: 1/2 manifests (50.00%)
562 bundling: 1/2 manifests (50.00%)
565 bundling: 1/2 manifests (50.00%)
563 bundling: 1/2 manifests (50.00%)
566 bundling: 2/2 manifests (100.00%)
564 bundling: 2/2 manifests (100.00%)
567 bundling: b 0/2 files (0.00%)
565 bundling: b 0/2 files (0.00%)
568 bundling: b 0/2 files (0.00%)
566 bundling: b 0/2 files (0.00%)
569 bundling: b 0/2 files (0.00%)
567 bundling: b 0/2 files (0.00%)
570 bundling: b 0/2 files (0.00%)
568 bundling: b 0/2 files (0.00%)
571 bundling: b1 1/2 files (50.00%)
569 bundling: b1 1/2 files (50.00%)
572 bundling: b1 1/2 files (50.00%)
570 bundling: b1 1/2 files (50.00%)
573 bundling: b1 1/2 files (50.00%)
571 bundling: b1 1/2 files (50.00%)
574 bundling: b1 1/2 files (50.00%)
572 bundling: b1 1/2 files (50.00%)
575
573
@@ -1,483 +1,481 b''
1 $ cp "$TESTDIR"/printenv.py .
2
3 commit hooks can see env vars
1 commit hooks can see env vars
4
2
5 $ hg init a
3 $ hg init a
6 $ cd a
4 $ cd a
7 $ echo "[hooks]" > .hg/hgrc
5 $ echo "[hooks]" > .hg/hgrc
8 $ echo 'commit = unset HG_LOCAL HG_TAG; python ../printenv.py commit' >> .hg/hgrc
6 $ echo 'commit = unset HG_LOCAL HG_TAG; python "$TESTDIR"/printenv.py commit' >> .hg/hgrc
9 $ echo 'commit.b = unset HG_LOCAL HG_TAG; python ../printenv.py commit.b' >> .hg/hgrc
7 $ echo 'commit.b = unset HG_LOCAL HG_TAG; python "$TESTDIR"/printenv.py commit.b' >> .hg/hgrc
10 $ echo 'precommit = unset HG_LOCAL HG_NODE HG_TAG; python ../printenv.py precommit' >> .hg/hgrc
8 $ echo 'precommit = unset HG_LOCAL HG_NODE HG_TAG; python "$TESTDIR"/printenv.py precommit' >> .hg/hgrc
11 $ echo 'pretxncommit = unset HG_LOCAL HG_TAG; python ../printenv.py pretxncommit' >> .hg/hgrc
9 $ echo 'pretxncommit = unset HG_LOCAL HG_TAG; python "$TESTDIR"/printenv.py pretxncommit' >> .hg/hgrc
12 $ echo 'pretxncommit.tip = hg -q tip' >> .hg/hgrc
10 $ echo 'pretxncommit.tip = hg -q tip' >> .hg/hgrc
13 $ echo 'pre-identify = python ../printenv.py pre-identify 1' >> .hg/hgrc
11 $ echo 'pre-identify = python "$TESTDIR"/printenv.py pre-identify 1' >> .hg/hgrc
14 $ echo 'pre-cat = python ../printenv.py pre-cat' >> .hg/hgrc
12 $ echo 'pre-cat = python "$TESTDIR"/printenv.py pre-cat' >> .hg/hgrc
15 $ echo 'post-cat = python ../printenv.py post-cat' >> .hg/hgrc
13 $ echo 'post-cat = python "$TESTDIR"/printenv.py post-cat' >> .hg/hgrc
16 $ echo a > a
14 $ echo a > a
17 $ hg add a
15 $ hg add a
18 $ hg commit -m a
16 $ hg commit -m a
19 precommit hook: HG_PARENT1=0000000000000000000000000000000000000000
17 precommit hook: HG_PARENT1=0000000000000000000000000000000000000000
20 pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
18 pretxncommit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a
21 0:cb9a9f314b8b
19 0:cb9a9f314b8b
22 commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
20 commit hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
23 commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
21 commit.b hook: HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000
24
22
25 $ hg clone . ../b
23 $ hg clone . ../b
26 updating to branch default
24 updating to branch default
27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
25 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 $ cd ../b
26 $ cd ../b
29
27
30 changegroup hooks can see env vars
28 changegroup hooks can see env vars
31
29
32 $ echo '[hooks]' > .hg/hgrc
30 $ echo '[hooks]' > .hg/hgrc
33 $ echo 'prechangegroup = python ../printenv.py prechangegroup' >> .hg/hgrc
31 $ echo 'prechangegroup = python "$TESTDIR"/printenv.py prechangegroup' >> .hg/hgrc
34 $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
32 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc
35 $ echo 'incoming = python ../printenv.py incoming' >> .hg/hgrc
33 $ echo 'incoming = python "$TESTDIR"/printenv.py incoming' >> .hg/hgrc
36
34
37 pretxncommit and commit hooks can see both parents of merge
35 pretxncommit and commit hooks can see both parents of merge
38
36
39 $ cd ../a
37 $ cd ../a
40 $ echo b >> a
38 $ echo b >> a
41 $ hg commit -m a1 -d "1 0"
39 $ hg commit -m a1 -d "1 0"
42 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
40 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
43 pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
41 pretxncommit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
44 1:ab228980c14d
42 1:ab228980c14d
45 commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
43 commit hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
46 commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
44 commit.b hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
47 $ hg update -C 0
45 $ hg update -C 0
48 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 $ echo b > b
47 $ echo b > b
50 $ hg add b
48 $ hg add b
51 $ hg commit -m b -d '1 0'
49 $ hg commit -m b -d '1 0'
52 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
50 precommit hook: HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
53 pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
51 pretxncommit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a
54 2:ee9deb46ab31
52 2:ee9deb46ab31
55 commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
53 commit hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
56 commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
54 commit.b hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
57 created new head
55 created new head
58 $ hg merge 1
56 $ hg merge 1
59 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
57 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
60 (branch merge, don't forget to commit)
58 (branch merge, don't forget to commit)
61 $ hg commit -m merge -d '2 0'
59 $ hg commit -m merge -d '2 0'
62 precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
60 precommit hook: HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
63 pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
61 pretxncommit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a
64 3:07f3376c1e65
62 3:07f3376c1e65
65 commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
63 commit hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
66 commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
64 commit.b hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd
67
65
68 test generic hooks
66 test generic hooks
69
67
70 $ hg id
68 $ hg id
71 pre-identify hook: HG_ARGS=id HG_OPTS={'branch': None, 'id': None, 'num': None, 'rev': '', 'tags': None} HG_PATS=[]
69 pre-identify hook: HG_ARGS=id HG_OPTS={'branch': None, 'id': None, 'num': None, 'rev': '', 'tags': None} HG_PATS=[]
72 warning: pre-identify hook exited with status 1
70 warning: pre-identify hook exited with status 1
73 [1]
71 [1]
74 $ hg cat b
72 $ hg cat b
75 pre-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b']
73 pre-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b']
76 b
74 b
77 post-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0
75 post-cat hook: HG_ARGS=cat b HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': ''} HG_PATS=['b'] HG_RESULT=0
78
76
79 $ cd ../b
77 $ cd ../b
80 $ hg pull ../a
78 $ hg pull ../a
81 prechangegroup hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
79 prechangegroup hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
82 changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
80 changegroup hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
83 incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
81 incoming hook: HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_URL=file:$TESTTMP/a
84 incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
82 incoming hook: HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
85 incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
83 incoming hook: HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_URL=file:$TESTTMP/a
86 pulling from ../a
84 pulling from ../a
87 searching for changes
85 searching for changes
88 adding changesets
86 adding changesets
89 adding manifests
87 adding manifests
90 adding file changes
88 adding file changes
91 added 3 changesets with 2 changes to 2 files
89 added 3 changesets with 2 changes to 2 files
92 (run 'hg update' to get a working copy)
90 (run 'hg update' to get a working copy)
93
91
94 tag hooks can see env vars
92 tag hooks can see env vars
95
93
96 $ cd ../a
94 $ cd ../a
97 $ echo 'pretag = python ../printenv.py pretag' >> .hg/hgrc
95 $ echo 'pretag = python "$TESTDIR"/printenv.py pretag' >> .hg/hgrc
98 $ echo 'tag = unset HG_PARENT1 HG_PARENT2; python ../printenv.py tag' >> .hg/hgrc
96 $ echo 'tag = unset HG_PARENT1 HG_PARENT2; python "$TESTDIR"/printenv.py tag' >> .hg/hgrc
99 $ hg tag -d '3 0' a
97 $ hg tag -d '3 0' a
100 pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
98 pretag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
101 precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
99 precommit hook: HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
102 pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
100 pretxncommit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a
103 4:539e4b31b6dc
101 4:539e4b31b6dc
104 commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
102 commit hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
105 commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
103 commit.b hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2
106 tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
104 tag hook: HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a
107 $ hg tag -l la
105 $ hg tag -l la
108 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
106 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
109 tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
107 tag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la
110
108
111 pretag hook can forbid tagging
109 pretag hook can forbid tagging
112
110
113 $ echo 'pretag.forbid = python ../printenv.py pretag.forbid 1' >> .hg/hgrc
111 $ echo 'pretag.forbid = python "$TESTDIR"/printenv.py pretag.forbid 1' >> .hg/hgrc
114 $ hg tag -d '4 0' fa
112 $ hg tag -d '4 0' fa
115 pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
113 pretag hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
116 pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
114 pretag.forbid hook: HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa
117 abort: pretag.forbid hook exited with status 1
115 abort: pretag.forbid hook exited with status 1
118 [255]
116 [255]
119 $ hg tag -l fla
117 $ hg tag -l fla
120 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
118 pretag hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
121 pretag.forbid hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
119 pretag.forbid hook: HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla
122 abort: pretag.forbid hook exited with status 1
120 abort: pretag.forbid hook exited with status 1
123 [255]
121 [255]
124
122
125 pretxncommit hook can see changeset, can roll back txn, changeset no
123 pretxncommit hook can see changeset, can roll back txn, changeset no
126 more there after
124 more there after
127
125
128 $ echo 'pretxncommit.forbid0 = hg tip -q' >> .hg/hgrc
126 $ echo 'pretxncommit.forbid0 = hg tip -q' >> .hg/hgrc
129 $ echo 'pretxncommit.forbid1 = python ../printenv.py pretxncommit.forbid 1' >> .hg/hgrc
127 $ echo 'pretxncommit.forbid1 = python "$TESTDIR"/printenv.py pretxncommit.forbid 1' >> .hg/hgrc
130 $ echo z > z
128 $ echo z > z
131 $ hg add z
129 $ hg add z
132 $ hg -q tip
130 $ hg -q tip
133 4:539e4b31b6dc
131 4:539e4b31b6dc
134 $ hg commit -m 'fail' -d '4 0'
132 $ hg commit -m 'fail' -d '4 0'
135 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
133 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
136 pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
134 pretxncommit hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
137 5:6f611f8018c1
135 5:6f611f8018c1
138 5:6f611f8018c1
136 5:6f611f8018c1
139 pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
137 pretxncommit.forbid hook: HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a
140 transaction abort!
138 transaction abort!
141 rollback completed
139 rollback completed
142 abort: pretxncommit.forbid1 hook exited with status 1
140 abort: pretxncommit.forbid1 hook exited with status 1
143 [255]
141 [255]
144 $ hg -q tip
142 $ hg -q tip
145 4:539e4b31b6dc
143 4:539e4b31b6dc
146
144
147 precommit hook can prevent commit
145 precommit hook can prevent commit
148
146
149 $ echo 'precommit.forbid = python ../printenv.py precommit.forbid 1' >> .hg/hgrc
147 $ echo 'precommit.forbid = python "$TESTDIR"/printenv.py precommit.forbid 1' >> .hg/hgrc
150 $ hg commit -m 'fail' -d '4 0'
148 $ hg commit -m 'fail' -d '4 0'
151 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
149 precommit hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
152 precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
150 precommit.forbid hook: HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10
153 abort: precommit.forbid hook exited with status 1
151 abort: precommit.forbid hook exited with status 1
154 [255]
152 [255]
155 $ hg -q tip
153 $ hg -q tip
156 4:539e4b31b6dc
154 4:539e4b31b6dc
157
155
158 preupdate hook can prevent update
156 preupdate hook can prevent update
159
157
160 $ echo 'preupdate = python ../printenv.py preupdate' >> .hg/hgrc
158 $ echo 'preupdate = python "$TESTDIR"/printenv.py preupdate' >> .hg/hgrc
161 $ hg update 1
159 $ hg update 1
162 preupdate hook: HG_PARENT1=ab228980c14d
160 preupdate hook: HG_PARENT1=ab228980c14d
163 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
161 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
164
162
165 update hook
163 update hook
166
164
167 $ echo 'update = python ../printenv.py update' >> .hg/hgrc
165 $ echo 'update = python "$TESTDIR"/printenv.py update' >> .hg/hgrc
168 $ hg update
166 $ hg update
169 preupdate hook: HG_PARENT1=539e4b31b6dc
167 preupdate hook: HG_PARENT1=539e4b31b6dc
170 update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
168 update hook: HG_ERROR=0 HG_PARENT1=539e4b31b6dc
171 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
169 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
172
170
173 prechangegroup hook can prevent incoming changes
171 prechangegroup hook can prevent incoming changes
174
172
175 $ cd ../b
173 $ cd ../b
176 $ hg -q tip
174 $ hg -q tip
177 3:07f3376c1e65
175 3:07f3376c1e65
178 $ echo '[hooks]' > .hg/hgrc
176 $ echo '[hooks]' > .hg/hgrc
179 $ echo 'prechangegroup.forbid = python ../printenv.py prechangegroup.forbid 1' >> .hg/hgrc
177 $ echo 'prechangegroup.forbid = python "$TESTDIR"/printenv.py prechangegroup.forbid 1' >> .hg/hgrc
180 $ hg pull ../a
178 $ hg pull ../a
181 prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
179 prechangegroup.forbid hook: HG_SOURCE=pull HG_URL=file:$TESTTMP/a
182 pulling from ../a
180 pulling from ../a
183 searching for changes
181 searching for changes
184 abort: prechangegroup.forbid hook exited with status 1
182 abort: prechangegroup.forbid hook exited with status 1
185 [255]
183 [255]
186
184
187 pretxnchangegroup hook can see incoming changes, can roll back txn,
185 pretxnchangegroup hook can see incoming changes, can roll back txn,
188 incoming changes no longer there after
186 incoming changes no longer there after
189
187
190 $ echo '[hooks]' > .hg/hgrc
188 $ echo '[hooks]' > .hg/hgrc
191 $ echo 'pretxnchangegroup.forbid0 = hg tip -q' >> .hg/hgrc
189 $ echo 'pretxnchangegroup.forbid0 = hg tip -q' >> .hg/hgrc
192 $ echo 'pretxnchangegroup.forbid1 = python ../printenv.py pretxnchangegroup.forbid 1' >> .hg/hgrc
190 $ echo 'pretxnchangegroup.forbid1 = python "$TESTDIR"/printenv.py pretxnchangegroup.forbid 1' >> .hg/hgrc
193 $ hg pull ../a
191 $ hg pull ../a
194 4:539e4b31b6dc
192 4:539e4b31b6dc
195 pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_URL=file:$TESTTMP/a
193 pretxnchangegroup.forbid hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_URL=file:$TESTTMP/a
196 pulling from ../a
194 pulling from ../a
197 searching for changes
195 searching for changes
198 adding changesets
196 adding changesets
199 adding manifests
197 adding manifests
200 adding file changes
198 adding file changes
201 added 1 changesets with 1 changes to 1 files
199 added 1 changesets with 1 changes to 1 files
202 transaction abort!
200 transaction abort!
203 rollback completed
201 rollback completed
204 abort: pretxnchangegroup.forbid1 hook exited with status 1
202 abort: pretxnchangegroup.forbid1 hook exited with status 1
205 [255]
203 [255]
206 $ hg -q tip
204 $ hg -q tip
207 3:07f3376c1e65
205 3:07f3376c1e65
208
206
209 outgoing hooks can see env vars
207 outgoing hooks can see env vars
210
208
211 $ rm .hg/hgrc
209 $ rm .hg/hgrc
212 $ echo '[hooks]' > ../a/.hg/hgrc
210 $ echo '[hooks]' > ../a/.hg/hgrc
213 $ echo 'preoutgoing = python ../printenv.py preoutgoing' >> ../a/.hg/hgrc
211 $ echo 'preoutgoing = python "$TESTDIR"/printenv.py preoutgoing' >> ../a/.hg/hgrc
214 $ echo 'outgoing = python ../printenv.py outgoing' >> ../a/.hg/hgrc
212 $ echo 'outgoing = python "$TESTDIR"/printenv.py outgoing' >> ../a/.hg/hgrc
215 $ hg pull ../a
213 $ hg pull ../a
216 preoutgoing hook: HG_SOURCE=pull
214 preoutgoing hook: HG_SOURCE=pull
217 outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
215 outgoing hook: HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull
218 pulling from ../a
216 pulling from ../a
219 searching for changes
217 searching for changes
220 adding changesets
218 adding changesets
221 adding manifests
219 adding manifests
222 adding file changes
220 adding file changes
223 added 1 changesets with 1 changes to 1 files
221 added 1 changesets with 1 changes to 1 files
224 (run 'hg update' to get a working copy)
222 (run 'hg update' to get a working copy)
225 $ hg rollback
223 $ hg rollback
226 rolling back to revision 3 (undo pull)
224 rolling back to revision 3 (undo pull)
227
225
228 preoutgoing hook can prevent outgoing changes
226 preoutgoing hook can prevent outgoing changes
229
227
230 $ echo 'preoutgoing.forbid = python ../printenv.py preoutgoing.forbid 1' >> ../a/.hg/hgrc
228 $ echo 'preoutgoing.forbid = python "$TESTDIR"/printenv.py preoutgoing.forbid 1' >> ../a/.hg/hgrc
231 $ hg pull ../a
229 $ hg pull ../a
232 preoutgoing hook: HG_SOURCE=pull
230 preoutgoing hook: HG_SOURCE=pull
233 preoutgoing.forbid hook: HG_SOURCE=pull
231 preoutgoing.forbid hook: HG_SOURCE=pull
234 pulling from ../a
232 pulling from ../a
235 searching for changes
233 searching for changes
236 abort: preoutgoing.forbid hook exited with status 1
234 abort: preoutgoing.forbid hook exited with status 1
237 [255]
235 [255]
238
236
239 outgoing hooks work for local clones
237 outgoing hooks work for local clones
240
238
241 $ cd ..
239 $ cd ..
242 $ echo '[hooks]' > a/.hg/hgrc
240 $ echo '[hooks]' > a/.hg/hgrc
243 $ echo 'preoutgoing = python ../printenv.py preoutgoing' >> a/.hg/hgrc
241 $ echo 'preoutgoing = python "$TESTDIR"/printenv.py preoutgoing' >> a/.hg/hgrc
244 $ echo 'outgoing = python ../printenv.py outgoing' >> a/.hg/hgrc
242 $ echo 'outgoing = python "$TESTDIR"/printenv.py outgoing' >> a/.hg/hgrc
245 $ hg clone a c
243 $ hg clone a c
246 preoutgoing hook: HG_SOURCE=clone
244 preoutgoing hook: HG_SOURCE=clone
247 outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
245 outgoing hook: HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone
248 updating to branch default
246 updating to branch default
249 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
247 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
250 $ rm -rf c
248 $ rm -rf c
251
249
252 preoutgoing hook can prevent outgoing changes for local clones
250 preoutgoing hook can prevent outgoing changes for local clones
253
251
254 $ echo 'preoutgoing.forbid = python ../printenv.py preoutgoing.forbid 1' >> a/.hg/hgrc
252 $ echo 'preoutgoing.forbid = python "$TESTDIR"/printenv.py preoutgoing.forbid 1' >> a/.hg/hgrc
255 $ hg clone a zzz
253 $ hg clone a zzz
256 preoutgoing hook: HG_SOURCE=clone
254 preoutgoing hook: HG_SOURCE=clone
257 preoutgoing.forbid hook: HG_SOURCE=clone
255 preoutgoing.forbid hook: HG_SOURCE=clone
258 abort: preoutgoing.forbid hook exited with status 1
256 abort: preoutgoing.forbid hook exited with status 1
259 [255]
257 [255]
260 $ cd b
258 $ cd b
261
259
262 $ cat > hooktests.py <<EOF
260 $ cat > hooktests.py <<EOF
263 > from mercurial import util
261 > from mercurial import util
264 >
262 >
265 > uncallable = 0
263 > uncallable = 0
266 >
264 >
267 > def printargs(args):
265 > def printargs(args):
268 > args.pop('ui', None)
266 > args.pop('ui', None)
269 > args.pop('repo', None)
267 > args.pop('repo', None)
270 > a = list(args.items())
268 > a = list(args.items())
271 > a.sort()
269 > a.sort()
272 > print 'hook args:'
270 > print 'hook args:'
273 > for k, v in a:
271 > for k, v in a:
274 > print ' ', k, v
272 > print ' ', k, v
275 >
273 >
276 > def passhook(**args):
274 > def passhook(**args):
277 > printargs(args)
275 > printargs(args)
278 >
276 >
279 > def failhook(**args):
277 > def failhook(**args):
280 > printargs(args)
278 > printargs(args)
281 > return True
279 > return True
282 >
280 >
283 > class LocalException(Exception):
281 > class LocalException(Exception):
284 > pass
282 > pass
285 >
283 >
286 > def raisehook(**args):
284 > def raisehook(**args):
287 > raise LocalException('exception from hook')
285 > raise LocalException('exception from hook')
288 >
286 >
289 > def aborthook(**args):
287 > def aborthook(**args):
290 > raise util.Abort('raise abort from hook')
288 > raise util.Abort('raise abort from hook')
291 >
289 >
292 > def brokenhook(**args):
290 > def brokenhook(**args):
293 > return 1 + {}
291 > return 1 + {}
294 >
292 >
295 > class container:
293 > class container:
296 > unreachable = 1
294 > unreachable = 1
297 > EOF
295 > EOF
298
296
299 test python hooks
297 test python hooks
300
298
301 $ PYTHONPATH="`pwd`:$PYTHONPATH"
299 $ PYTHONPATH="`pwd`:$PYTHONPATH"
302 $ export PYTHONPATH
300 $ export PYTHONPATH
303
301
304 $ echo '[hooks]' > ../a/.hg/hgrc
302 $ echo '[hooks]' > ../a/.hg/hgrc
305 $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
303 $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc
306 $ hg pull ../a 2>&1 | grep 'raised an exception'
304 $ hg pull ../a 2>&1 | grep 'raised an exception'
307 error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
305 error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict'
308
306
309 $ echo '[hooks]' > ../a/.hg/hgrc
307 $ echo '[hooks]' > ../a/.hg/hgrc
310 $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
308 $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc
311 $ hg pull ../a 2>&1 | grep 'raised an exception'
309 $ hg pull ../a 2>&1 | grep 'raised an exception'
312 error: preoutgoing.raise hook raised an exception: exception from hook
310 error: preoutgoing.raise hook raised an exception: exception from hook
313
311
314 $ echo '[hooks]' > ../a/.hg/hgrc
312 $ echo '[hooks]' > ../a/.hg/hgrc
315 $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
313 $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc
316 $ hg pull ../a
314 $ hg pull ../a
317 pulling from ../a
315 pulling from ../a
318 searching for changes
316 searching for changes
319 error: preoutgoing.abort hook failed: raise abort from hook
317 error: preoutgoing.abort hook failed: raise abort from hook
320 abort: raise abort from hook
318 abort: raise abort from hook
321 [255]
319 [255]
322
320
323 $ echo '[hooks]' > ../a/.hg/hgrc
321 $ echo '[hooks]' > ../a/.hg/hgrc
324 $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
322 $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc
325 $ hg pull ../a
323 $ hg pull ../a
326 pulling from ../a
324 pulling from ../a
327 searching for changes
325 searching for changes
328 hook args:
326 hook args:
329 hooktype preoutgoing
327 hooktype preoutgoing
330 source pull
328 source pull
331 abort: preoutgoing.fail hook failed
329 abort: preoutgoing.fail hook failed
332 [255]
330 [255]
333
331
334 $ echo '[hooks]' > ../a/.hg/hgrc
332 $ echo '[hooks]' > ../a/.hg/hgrc
335 $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
333 $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc
336 $ hg pull ../a
334 $ hg pull ../a
337 pulling from ../a
335 pulling from ../a
338 searching for changes
336 searching for changes
339 abort: preoutgoing.uncallable hook is invalid ("hooktests.uncallable" is not callable)
337 abort: preoutgoing.uncallable hook is invalid ("hooktests.uncallable" is not callable)
340 [255]
338 [255]
341
339
342 $ echo '[hooks]' > ../a/.hg/hgrc
340 $ echo '[hooks]' > ../a/.hg/hgrc
343 $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
341 $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc
344 $ hg pull ../a
342 $ hg pull ../a
345 pulling from ../a
343 pulling from ../a
346 searching for changes
344 searching for changes
347 abort: preoutgoing.nohook hook is invalid ("hooktests.nohook" is not defined)
345 abort: preoutgoing.nohook hook is invalid ("hooktests.nohook" is not defined)
348 [255]
346 [255]
349
347
350 $ echo '[hooks]' > ../a/.hg/hgrc
348 $ echo '[hooks]' > ../a/.hg/hgrc
351 $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
349 $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc
352 $ hg pull ../a
350 $ hg pull ../a
353 pulling from ../a
351 pulling from ../a
354 searching for changes
352 searching for changes
355 abort: preoutgoing.nomodule hook is invalid ("nomodule" not in a module)
353 abort: preoutgoing.nomodule hook is invalid ("nomodule" not in a module)
356 [255]
354 [255]
357
355
358 $ echo '[hooks]' > ../a/.hg/hgrc
356 $ echo '[hooks]' > ../a/.hg/hgrc
359 $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
357 $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc
360 $ hg pull ../a
358 $ hg pull ../a
361 pulling from ../a
359 pulling from ../a
362 searching for changes
360 searching for changes
363 abort: preoutgoing.badmodule hook is invalid (import of "nomodule" failed)
361 abort: preoutgoing.badmodule hook is invalid (import of "nomodule" failed)
364 [255]
362 [255]
365
363
366 $ echo '[hooks]' > ../a/.hg/hgrc
364 $ echo '[hooks]' > ../a/.hg/hgrc
367 $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc
365 $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc
368 $ hg pull ../a
366 $ hg pull ../a
369 pulling from ../a
367 pulling from ../a
370 searching for changes
368 searching for changes
371 abort: preoutgoing.unreachable hook is invalid (import of "hooktests.container" failed)
369 abort: preoutgoing.unreachable hook is invalid (import of "hooktests.container" failed)
372 [255]
370 [255]
373
371
374 $ echo '[hooks]' > ../a/.hg/hgrc
372 $ echo '[hooks]' > ../a/.hg/hgrc
375 $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
373 $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc
376 $ hg pull ../a
374 $ hg pull ../a
377 pulling from ../a
375 pulling from ../a
378 searching for changes
376 searching for changes
379 hook args:
377 hook args:
380 hooktype preoutgoing
378 hooktype preoutgoing
381 source pull
379 source pull
382 adding changesets
380 adding changesets
383 adding manifests
381 adding manifests
384 adding file changes
382 adding file changes
385 added 1 changesets with 1 changes to 1 files
383 added 1 changesets with 1 changes to 1 files
386 (run 'hg update' to get a working copy)
384 (run 'hg update' to get a working copy)
387
385
388 make sure --traceback works
386 make sure --traceback works
389
387
390 $ echo '[hooks]' > .hg/hgrc
388 $ echo '[hooks]' > .hg/hgrc
391 $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc
389 $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc
392
390
393 $ echo aa > a
391 $ echo aa > a
394 $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback'
392 $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback'
395 Traceback (most recent call last):
393 Traceback (most recent call last):
396
394
397 $ cd ..
395 $ cd ..
398 $ hg init c
396 $ hg init c
399 $ cd c
397 $ cd c
400
398
401 $ cat > hookext.py <<EOF
399 $ cat > hookext.py <<EOF
402 > def autohook(**args):
400 > def autohook(**args):
403 > print "Automatically installed hook"
401 > print "Automatically installed hook"
404 >
402 >
405 > def reposetup(ui, repo):
403 > def reposetup(ui, repo):
406 > repo.ui.setconfig("hooks", "commit.auto", autohook)
404 > repo.ui.setconfig("hooks", "commit.auto", autohook)
407 > EOF
405 > EOF
408 $ echo '[extensions]' >> .hg/hgrc
406 $ echo '[extensions]' >> .hg/hgrc
409 $ echo 'hookext = hookext.py' >> .hg/hgrc
407 $ echo 'hookext = hookext.py' >> .hg/hgrc
410
408
411 $ touch foo
409 $ touch foo
412 $ hg add foo
410 $ hg add foo
413 $ hg ci -d '0 0' -m 'add foo'
411 $ hg ci -d '0 0' -m 'add foo'
414 Automatically installed hook
412 Automatically installed hook
415 $ echo >> foo
413 $ echo >> foo
416 $ hg ci --debug -d '0 0' -m 'change foo'
414 $ hg ci --debug -d '0 0' -m 'change foo'
417 foo
415 foo
418 calling hook commit.auto: <function autohook at *> (glob)
416 calling hook commit.auto: <function autohook at *> (glob)
419 Automatically installed hook
417 Automatically installed hook
420 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
418 committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708
421
419
422 $ hg showconfig hooks
420 $ hg showconfig hooks
423 hooks.commit.auto=<function autohook at *> (glob)
421 hooks.commit.auto=<function autohook at *> (glob)
424
422
425 test python hook configured with python:[file]:[hook] syntax
423 test python hook configured with python:[file]:[hook] syntax
426
424
427 $ cd ..
425 $ cd ..
428 $ mkdir d
426 $ mkdir d
429 $ cd d
427 $ cd d
430 $ hg init repo
428 $ hg init repo
431 $ mkdir hooks
429 $ mkdir hooks
432
430
433 $ cd hooks
431 $ cd hooks
434 $ cat > testhooks.py <<EOF
432 $ cat > testhooks.py <<EOF
435 > def testhook(**args):
433 > def testhook(**args):
436 > print 'hook works'
434 > print 'hook works'
437 > EOF
435 > EOF
438 $ echo '[hooks]' > ../repo/.hg/hgrc
436 $ echo '[hooks]' > ../repo/.hg/hgrc
439 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
437 $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc
440
438
441 $ cd ../repo
439 $ cd ../repo
442 $ hg commit -d '0 0'
440 $ hg commit -d '0 0'
443 hook works
441 hook works
444 nothing changed
442 nothing changed
445 [1]
443 [1]
446
444
447 $ cd ../../b
445 $ cd ../../b
448
446
449 make sure --traceback works on hook import failure
447 make sure --traceback works on hook import failure
450
448
451 $ cat > importfail.py <<EOF
449 $ cat > importfail.py <<EOF
452 > import somebogusmodule
450 > import somebogusmodule
453 > # dereference something in the module to force demandimport to load it
451 > # dereference something in the module to force demandimport to load it
454 > somebogusmodule.whatever
452 > somebogusmodule.whatever
455 > EOF
453 > EOF
456
454
457 $ echo '[hooks]' > .hg/hgrc
455 $ echo '[hooks]' > .hg/hgrc
458 $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
456 $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc
459
457
460 $ echo a >> a
458 $ echo a >> a
461 $ hg --traceback commit -ma 2>&1 | egrep '^(exception|Traceback|ImportError)'
459 $ hg --traceback commit -ma 2>&1 | egrep '^(exception|Traceback|ImportError)'
462 exception from first failed import attempt:
460 exception from first failed import attempt:
463 Traceback (most recent call last):
461 Traceback (most recent call last):
464 ImportError: No module named somebogusmodule
462 ImportError: No module named somebogusmodule
465 exception from second failed import attempt:
463 exception from second failed import attempt:
466 Traceback (most recent call last):
464 Traceback (most recent call last):
467 ImportError: No module named hgext_importfail
465 ImportError: No module named hgext_importfail
468 Traceback (most recent call last):
466 Traceback (most recent call last):
469
467
470 Issue1827: Hooks Update & Commit not completely post operation
468 Issue1827: Hooks Update & Commit not completely post operation
471
469
472 commit and update hooks should run after command completion
470 commit and update hooks should run after command completion
473
471
474 $ echo '[hooks]' > .hg/hgrc
472 $ echo '[hooks]' > .hg/hgrc
475 $ echo 'commit = hg id' >> .hg/hgrc
473 $ echo 'commit = hg id' >> .hg/hgrc
476 $ echo 'update = hg id' >> .hg/hgrc
474 $ echo 'update = hg id' >> .hg/hgrc
477 $ echo bb > a
475 $ echo bb > a
478 $ hg ci -ma
476 $ hg ci -ma
479 223eafe2750c tip
477 223eafe2750c tip
480 $ hg up 0
478 $ hg up 0
481 cb9a9f314b8b
479 cb9a9f314b8b
482 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
480 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
483
481
@@ -1,88 +1,87 b''
1
1
2 $ cp "$TESTDIR"/printenv.py .
3 $ hg init test
2 $ hg init test
4 $ cd test
3 $ cd test
5 $ echo foo>foo
4 $ echo foo>foo
6 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
5 $ mkdir foo.d foo.d/bAr.hg.d foo.d/baR.d.hg
7 $ echo foo>foo.d/foo
6 $ echo foo>foo.d/foo
8 $ echo bar>foo.d/bAr.hg.d/BaR
7 $ echo bar>foo.d/bAr.hg.d/BaR
9 $ echo bar>foo.d/baR.d.hg/bAR
8 $ echo bar>foo.d/baR.d.hg/bAR
10 $ hg commit -A -m 1
9 $ hg commit -A -m 1
11 adding foo
10 adding foo
12 adding foo.d/bAr.hg.d/BaR
11 adding foo.d/bAr.hg.d/BaR
13 adding foo.d/baR.d.hg/bAR
12 adding foo.d/baR.d.hg/bAR
14 adding foo.d/foo
13 adding foo.d/foo
15 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid
14 $ hg serve -p $HGPORT -d --pid-file=../hg1.pid
16 $ hg --config server.uncompressed=False serve -p $HGPORT1 -d --pid-file=../hg2.pid
15 $ hg --config server.uncompressed=False serve -p $HGPORT1 -d --pid-file=../hg2.pid
17
16
18 Test server address cannot be reused
17 Test server address cannot be reused
19
18
20 $ hg serve -p $HGPORT1 2>&1
19 $ hg serve -p $HGPORT1 2>&1
21 abort: cannot start server at ':$HGPORT1': Address already in use
20 abort: cannot start server at ':$HGPORT1': Address already in use
22 [255]
21 [255]
23 $ cd ..
22 $ cd ..
24 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
23 $ cat hg1.pid hg2.pid >> $DAEMON_PIDS
25
24
26 clone via stream
25 clone via stream
27
26
28 $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1
27 $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1
29 streaming all changes
28 streaming all changes
30 6 files to transfer, 606 bytes of data
29 6 files to transfer, 606 bytes of data
31 transferred * bytes in * seconds (*B/sec) (glob)
30 transferred * bytes in * seconds (*B/sec) (glob)
32 updating to branch default
31 updating to branch default
33 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
32 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
34 $ hg verify -R copy
33 $ hg verify -R copy
35 checking changesets
34 checking changesets
36 checking manifests
35 checking manifests
37 crosschecking files in changesets and manifests
36 crosschecking files in changesets and manifests
38 checking files
37 checking files
39 4 files, 1 changesets, 4 total revisions
38 4 files, 1 changesets, 4 total revisions
40
39
41 try to clone via stream, should use pull instead
40 try to clone via stream, should use pull instead
42
41
43 $ hg clone --uncompressed http://localhost:$HGPORT1/ copy2
42 $ hg clone --uncompressed http://localhost:$HGPORT1/ copy2
44 requesting all changes
43 requesting all changes
45 adding changesets
44 adding changesets
46 adding manifests
45 adding manifests
47 adding file changes
46 adding file changes
48 added 1 changesets with 4 changes to 4 files
47 added 1 changesets with 4 changes to 4 files
49 updating to branch default
48 updating to branch default
50 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
51
50
52 clone via pull
51 clone via pull
53
52
54 $ hg clone http://localhost:$HGPORT1/ copy-pull
53 $ hg clone http://localhost:$HGPORT1/ copy-pull
55 requesting all changes
54 requesting all changes
56 adding changesets
55 adding changesets
57 adding manifests
56 adding manifests
58 adding file changes
57 adding file changes
59 added 1 changesets with 4 changes to 4 files
58 added 1 changesets with 4 changes to 4 files
60 updating to branch default
59 updating to branch default
61 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
60 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 $ hg verify -R copy-pull
61 $ hg verify -R copy-pull
63 checking changesets
62 checking changesets
64 checking manifests
63 checking manifests
65 crosschecking files in changesets and manifests
64 crosschecking files in changesets and manifests
66 checking files
65 checking files
67 4 files, 1 changesets, 4 total revisions
66 4 files, 1 changesets, 4 total revisions
68 $ cd test
67 $ cd test
69 $ echo bar > bar
68 $ echo bar > bar
70 $ hg commit -A -d '1 0' -m 2
69 $ hg commit -A -d '1 0' -m 2
71 adding bar
70 adding bar
72 $ cd ..
71 $ cd ..
73
72
74 pull
73 pull
75
74
76 $ cd copy-pull
75 $ cd copy-pull
77 $ echo '[hooks]' >> .hg/hgrc
76 $ echo '[hooks]' >> .hg/hgrc
78 $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
77 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc
79 $ hg pull
78 $ hg pull
80 changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=http://localhost:$HGPORT1/
79 changegroup hook: HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_URL=http://localhost:$HGPORT1/
81 pulling from http://localhost:$HGPORT1/
80 pulling from http://localhost:$HGPORT1/
82 searching for changes
81 searching for changes
83 adding changesets
82 adding changesets
84 adding manifests
83 adding manifests
85 adding file changes
84 adding file changes
86 added 1 changesets with 1 changes to 1 files
85 added 1 changesets with 1 changes to 1 files
87 (run 'hg update' to get a working copy)
86 (run 'hg update' to get a working copy)
88 $ cd ..
87 $ cd ..
@@ -1,46 +1,45 b''
1
1
2 $ cp "$TESTDIR"/printenv.py .
3 $ hg init test
2 $ hg init test
4 $ cd test
3 $ cd test
5 $ echo a > a
4 $ echo a > a
6 $ hg ci -Ama
5 $ hg ci -Ama
7 adding a
6 adding a
8 $ cd ..
7 $ cd ..
9 $ hg clone test test2
8 $ hg clone test test2
10 updating to branch default
9 updating to branch default
11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 $ cd test2
11 $ cd test2
13 $ echo a >> a
12 $ echo a >> a
14 $ hg ci -mb
13 $ hg ci -mb
15
14
16 expect error, cloning not allowed
15 expect error, cloning not allowed
17
16
18 $ echo '[web]' > .hg/hgrc
17 $ echo '[web]' > .hg/hgrc
19 $ echo 'allowpull = false' >> .hg/hgrc
18 $ echo 'allowpull = false' >> .hg/hgrc
20 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
19 $ hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
21 $ cat hg.pid >> $DAEMON_PIDS
20 $ cat hg.pid >> $DAEMON_PIDS
22 $ hg clone http://localhost:$HGPORT/ test3
21 $ hg clone http://localhost:$HGPORT/ test3
23 requesting all changes
22 requesting all changes
24 abort: authorization failed
23 abort: authorization failed
25 [255]
24 [255]
26 $ "$TESTDIR/killdaemons.py"
25 $ "$TESTDIR/killdaemons.py"
27
26
28 serve errors
27 serve errors
29
28
30 $ cat errors.log
29 $ cat errors.log
31 $ req() {
30 $ req() {
32 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
31 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
33 > cat hg.pid >> $DAEMON_PIDS
32 > cat hg.pid >> $DAEMON_PIDS
34 > hg --cwd ../test pull http://localhost:$HGPORT/
33 > hg --cwd ../test pull http://localhost:$HGPORT/
35 > kill `cat hg.pid`
34 > kill `cat hg.pid`
36 > echo % serve errors
35 > echo % serve errors
37 > cat errors.log
36 > cat errors.log
38 > }
37 > }
39
38
40 expect error, pulling not allowed
39 expect error, pulling not allowed
41
40
42 $ req
41 $ req
43 pulling from http://localhost:$HGPORT/
42 pulling from http://localhost:$HGPORT/
44 searching for changes
43 searching for changes
45 abort: authorization failed
44 abort: authorization failed
46 % serve errors
45 % serve errors
@@ -1,87 +1,86 b''
1
1
2 $ cp "$TESTDIR"/printenv.py .
3 $ hg init test
2 $ hg init test
4 $ cd test
3 $ cd test
5 $ echo a > a
4 $ echo a > a
6 $ hg ci -Ama
5 $ hg ci -Ama
7 adding a
6 adding a
8 $ cd ..
7 $ cd ..
9 $ hg clone test test2
8 $ hg clone test test2
10 updating to branch default
9 updating to branch default
11 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
10 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
12 $ cd test2
11 $ cd test2
13 $ echo a >> a
12 $ echo a >> a
14 $ hg ci -mb
13 $ hg ci -mb
15 $ req() {
14 $ req() {
16 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
15 > hg serve -p $HGPORT -d --pid-file=hg.pid -E errors.log
17 > cat hg.pid >> $DAEMON_PIDS
16 > cat hg.pid >> $DAEMON_PIDS
18 > hg --cwd ../test2 push http://localhost:$HGPORT/
17 > hg --cwd ../test2 push http://localhost:$HGPORT/
19 > kill `cat hg.pid`
18 > kill `cat hg.pid`
20 > echo % serve errors
19 > echo % serve errors
21 > cat errors.log
20 > cat errors.log
22 > }
21 > }
23 $ cd ../test
22 $ cd ../test
24
23
25 expect ssl error
24 expect ssl error
26
25
27 $ req
26 $ req
28 pushing to http://localhost:$HGPORT/
27 pushing to http://localhost:$HGPORT/
29 searching for changes
28 searching for changes
30 remote: ssl required
29 remote: ssl required
31 % serve errors
30 % serve errors
32
31
33 expect authorization error
32 expect authorization error
34
33
35 $ echo '[web]' > .hg/hgrc
34 $ echo '[web]' > .hg/hgrc
36 $ echo 'push_ssl = false' >> .hg/hgrc
35 $ echo 'push_ssl = false' >> .hg/hgrc
37 $ req
36 $ req
38 pushing to http://localhost:$HGPORT/
37 pushing to http://localhost:$HGPORT/
39 searching for changes
38 searching for changes
40 abort: authorization failed
39 abort: authorization failed
41 % serve errors
40 % serve errors
42
41
43 expect authorization error: must have authorized user
42 expect authorization error: must have authorized user
44
43
45 $ echo 'allow_push = unperson' >> .hg/hgrc
44 $ echo 'allow_push = unperson' >> .hg/hgrc
46 $ req
45 $ req
47 pushing to http://localhost:$HGPORT/
46 pushing to http://localhost:$HGPORT/
48 searching for changes
47 searching for changes
49 abort: authorization failed
48 abort: authorization failed
50 % serve errors
49 % serve errors
51
50
52 expect success
51 expect success
53
52
54 $ echo 'allow_push = *' >> .hg/hgrc
53 $ echo 'allow_push = *' >> .hg/hgrc
55 $ echo '[hooks]' >> .hg/hgrc
54 $ echo '[hooks]' >> .hg/hgrc
56 $ echo 'changegroup = python ../printenv.py changegroup 0' >> .hg/hgrc
55 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup 0' >> .hg/hgrc
57 $ req
56 $ req
58 pushing to http://localhost:$HGPORT/
57 pushing to http://localhost:$HGPORT/
59 searching for changes
58 searching for changes
60 remote: adding changesets
59 remote: adding changesets
61 remote: adding manifests
60 remote: adding manifests
62 remote: adding file changes
61 remote: adding file changes
63 remote: added 1 changesets with 1 changes to 1 files
62 remote: added 1 changesets with 1 changes to 1 files
64 remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob)
63 remote: changegroup hook: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_URL=remote:http:*: (glob)
65 % serve errors
64 % serve errors
66 $ hg rollback
65 $ hg rollback
67 rolling back to revision 0 (undo serve)
66 rolling back to revision 0 (undo serve)
68
67
69 expect authorization error: all users denied
68 expect authorization error: all users denied
70
69
71 $ echo '[web]' > .hg/hgrc
70 $ echo '[web]' > .hg/hgrc
72 $ echo 'push_ssl = false' >> .hg/hgrc
71 $ echo 'push_ssl = false' >> .hg/hgrc
73 $ echo 'deny_push = *' >> .hg/hgrc
72 $ echo 'deny_push = *' >> .hg/hgrc
74 $ req
73 $ req
75 pushing to http://localhost:$HGPORT/
74 pushing to http://localhost:$HGPORT/
76 searching for changes
75 searching for changes
77 abort: authorization failed
76 abort: authorization failed
78 % serve errors
77 % serve errors
79
78
80 expect authorization error: some users denied, users must be authenticated
79 expect authorization error: some users denied, users must be authenticated
81
80
82 $ echo 'deny_push = unperson' >> .hg/hgrc
81 $ echo 'deny_push = unperson' >> .hg/hgrc
83 $ req
82 $ req
84 pushing to http://localhost:$HGPORT/
83 pushing to http://localhost:$HGPORT/
85 searching for changes
84 searching for changes
86 abort: authorization failed
85 abort: authorization failed
87 % serve errors
86 % serve errors
@@ -1,292 +1,291 b''
1
1
2 $ cp "$TESTDIR"/printenv.py .
3
2
4 This test tries to exercise the ssh functionality with a dummy script
3 This test tries to exercise the ssh functionality with a dummy script
5
4
6 $ cat <<EOF > dummyssh
5 $ cat <<EOF > dummyssh
7 > import sys
6 > import sys
8 > import os
7 > import os
9 >
8 >
10 > os.chdir(os.path.dirname(sys.argv[0]))
9 > os.chdir(os.path.dirname(sys.argv[0]))
11 > if sys.argv[1] != "user@dummy":
10 > if sys.argv[1] != "user@dummy":
12 > sys.exit(-1)
11 > sys.exit(-1)
13 >
12 >
14 > if not os.path.exists("dummyssh"):
13 > if not os.path.exists("dummyssh"):
15 > sys.exit(-1)
14 > sys.exit(-1)
16 >
15 >
17 > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
16 > os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
18 >
17 >
19 > log = open("dummylog", "ab")
18 > log = open("dummylog", "ab")
20 > log.write("Got arguments")
19 > log.write("Got arguments")
21 > for i, arg in enumerate(sys.argv[1:]):
20 > for i, arg in enumerate(sys.argv[1:]):
22 > log.write(" %d:%s" % (i+1, arg))
21 > log.write(" %d:%s" % (i+1, arg))
23 > log.write("\n")
22 > log.write("\n")
24 > log.close()
23 > log.close()
25 > r = os.system(sys.argv[2])
24 > r = os.system(sys.argv[2])
26 > sys.exit(bool(r))
25 > sys.exit(bool(r))
27 > EOF
26 > EOF
28 $ cat <<EOF > badhook
27 $ cat <<EOF > badhook
29 > import sys
28 > import sys
30 > sys.stdout.write("KABOOM\n")
29 > sys.stdout.write("KABOOM\n")
31 > EOF
30 > EOF
32
31
33 creating 'remote
32 creating 'remote
34
33
35 $ hg init remote
34 $ hg init remote
36 $ cd remote
35 $ cd remote
37 $ echo this > foo
36 $ echo this > foo
38 $ echo this > fooO
37 $ echo this > fooO
39 $ hg ci -A -m "init" foo fooO
38 $ hg ci -A -m "init" foo fooO
40 $ echo <<EOF > .hg/hgrc
39 $ echo <<EOF > .hg/hgrc
41 > [server]
40 > [server]
42 > uncompressed = True
41 > uncompressed = True
43 >
42 >
44 > [extensions]
43 > [extensions]
45 > bookmarks =
44 > bookmarks =
46 >
45 >
47 > [hooks]
46 > [hooks]
48 > changegroup = python ../printenv.py changegroup-in-remote 0 ../dummylog
47 > changegroup = python "$TESTDIR"/printenv.py changegroup-in-remote 0 ../dummylog
49 > EOF
48 > EOF
50 $ cd ..
49 $ cd ..
51
50
52 repo not found error
51 repo not found error
53
52
54 $ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local
53 $ hg clone -e "python ./dummyssh" ssh://user@dummy/nonexistent local
55 remote: abort: There is no Mercurial repository here (.hg not found)!
54 remote: abort: There is no Mercurial repository here (.hg not found)!
56 abort: no suitable response from remote hg!
55 abort: no suitable response from remote hg!
57 [255]
56 [255]
58
57
59 non-existent absolute path
58 non-existent absolute path
60
59
61 $ hg clone -e "python ./dummyssh" ssh://user@dummy//`pwd`/nonexistent local
60 $ hg clone -e "python ./dummyssh" ssh://user@dummy//`pwd`/nonexistent local
62 remote: abort: There is no Mercurial repository here (.hg not found)!
61 remote: abort: There is no Mercurial repository here (.hg not found)!
63 abort: no suitable response from remote hg!
62 abort: no suitable response from remote hg!
64 [255]
63 [255]
65
64
66 clone remote via stream
65 clone remote via stream
67
66
68 $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream
67 $ hg clone -e "python ./dummyssh" --uncompressed ssh://user@dummy/remote local-stream
69 streaming all changes
68 streaming all changes
70 4 files to transfer, 392 bytes of data
69 4 files to transfer, 392 bytes of data
71 transferred 392 bytes in * seconds (*/sec) (glob)
70 transferred 392 bytes in * seconds (*/sec) (glob)
72 updating to branch default
71 updating to branch default
73 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
72 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 $ cd local-stream
73 $ cd local-stream
75 $ hg verify
74 $ hg verify
76 checking changesets
75 checking changesets
77 checking manifests
76 checking manifests
78 crosschecking files in changesets and manifests
77 crosschecking files in changesets and manifests
79 checking files
78 checking files
80 2 files, 1 changesets, 2 total revisions
79 2 files, 1 changesets, 2 total revisions
81 $ cd ..
80 $ cd ..
82
81
83 clone remote via pull
82 clone remote via pull
84
83
85 $ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local
84 $ hg clone -e "python ./dummyssh" ssh://user@dummy/remote local
86 requesting all changes
85 requesting all changes
87 adding changesets
86 adding changesets
88 adding manifests
87 adding manifests
89 adding file changes
88 adding file changes
90 added 1 changesets with 2 changes to 2 files
89 added 1 changesets with 2 changes to 2 files
91 updating to branch default
90 updating to branch default
92 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
93
92
94 verify
93 verify
95
94
96 $ cd local
95 $ cd local
97 $ hg verify
96 $ hg verify
98 checking changesets
97 checking changesets
99 checking manifests
98 checking manifests
100 crosschecking files in changesets and manifests
99 crosschecking files in changesets and manifests
101 checking files
100 checking files
102 2 files, 1 changesets, 2 total revisions
101 2 files, 1 changesets, 2 total revisions
103 $ echo '[hooks]' >> .hg/hgrc
102 $ echo '[hooks]' >> .hg/hgrc
104 $ echo 'changegroup = python ../printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc
103 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup-in-local 0 ../dummylog' >> .hg/hgrc
105
104
106 empty default pull
105 empty default pull
107
106
108 $ hg paths
107 $ hg paths
109 default = ssh://user@dummy/remote
108 default = ssh://user@dummy/remote
110 $ hg pull -e "python ../dummyssh"
109 $ hg pull -e "python ../dummyssh"
111 pulling from ssh://user@dummy/remote
110 pulling from ssh://user@dummy/remote
112 searching for changes
111 searching for changes
113 no changes found
112 no changes found
114
113
115 local change
114 local change
116
115
117 $ echo bleah > foo
116 $ echo bleah > foo
118 $ hg ci -m "add"
117 $ hg ci -m "add"
119
118
120 updating rc
119 updating rc
121
120
122 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
121 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
123 $ echo "[ui]" >> .hg/hgrc
122 $ echo "[ui]" >> .hg/hgrc
124 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
123 $ echo "ssh = python ../dummyssh" >> .hg/hgrc
125 $ echo '[extensions]' >> .hg/hgrc
124 $ echo '[extensions]' >> .hg/hgrc
126 $ echo 'bookmarks =' >> .hg/hgrc
125 $ echo 'bookmarks =' >> .hg/hgrc
127
126
128 find outgoing
127 find outgoing
129
128
130 $ hg out ssh://user@dummy/remote
129 $ hg out ssh://user@dummy/remote
131 comparing with ssh://user@dummy/remote
130 comparing with ssh://user@dummy/remote
132 searching for changes
131 searching for changes
133 changeset: 1:a28a9d1a809c
132 changeset: 1:a28a9d1a809c
134 tag: tip
133 tag: tip
135 user: test
134 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
135 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: add
136 summary: add
138
137
139
138
140 find incoming on the remote side
139 find incoming on the remote side
141
140
142 $ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local
141 $ hg incoming -R ../remote -e "python ../dummyssh" ssh://user@dummy/local
143 comparing with ssh://user@dummy/local
142 comparing with ssh://user@dummy/local
144 searching for changes
143 searching for changes
145 changeset: 1:a28a9d1a809c
144 changeset: 1:a28a9d1a809c
146 tag: tip
145 tag: tip
147 user: test
146 user: test
148 date: Thu Jan 01 00:00:00 1970 +0000
147 date: Thu Jan 01 00:00:00 1970 +0000
149 summary: add
148 summary: add
150
149
151
150
152 find incoming on the remote side (using absolute path)
151 find incoming on the remote side (using absolute path)
153
152
154 $ hg incoming -R ../remote -e "python ../dummyssh" "ssh://user@dummy/`pwd`"
153 $ hg incoming -R ../remote -e "python ../dummyssh" "ssh://user@dummy/`pwd`"
155 comparing with ssh://user@dummy/$TESTTMP/local
154 comparing with ssh://user@dummy/$TESTTMP/local
156 searching for changes
155 searching for changes
157 changeset: 1:a28a9d1a809c
156 changeset: 1:a28a9d1a809c
158 tag: tip
157 tag: tip
159 user: test
158 user: test
160 date: Thu Jan 01 00:00:00 1970 +0000
159 date: Thu Jan 01 00:00:00 1970 +0000
161 summary: add
160 summary: add
162
161
163
162
164 push
163 push
165
164
166 $ hg push
165 $ hg push
167 pushing to ssh://user@dummy/remote
166 pushing to ssh://user@dummy/remote
168 searching for changes
167 searching for changes
169 remote: adding changesets
168 remote: adding changesets
170 remote: adding manifests
169 remote: adding manifests
171 remote: adding file changes
170 remote: adding file changes
172 remote: added 1 changesets with 1 changes to 1 files
171 remote: added 1 changesets with 1 changes to 1 files
173 $ cd ../remote
172 $ cd ../remote
174
173
175 check remote tip
174 check remote tip
176
175
177 $ hg tip
176 $ hg tip
178 changeset: 1:a28a9d1a809c
177 changeset: 1:a28a9d1a809c
179 tag: tip
178 tag: tip
180 user: test
179 user: test
181 date: Thu Jan 01 00:00:00 1970 +0000
180 date: Thu Jan 01 00:00:00 1970 +0000
182 summary: add
181 summary: add
183
182
184 $ hg verify
183 $ hg verify
185 checking changesets
184 checking changesets
186 checking manifests
185 checking manifests
187 crosschecking files in changesets and manifests
186 crosschecking files in changesets and manifests
188 checking files
187 checking files
189 2 files, 2 changesets, 3 total revisions
188 2 files, 2 changesets, 3 total revisions
190 $ hg cat -r tip foo
189 $ hg cat -r tip foo
191 bleah
190 bleah
192 $ echo z > z
191 $ echo z > z
193 $ hg ci -A -m z z
192 $ hg ci -A -m z z
194 created new head
193 created new head
195
194
196 test pushkeys and bookmarks
195 test pushkeys and bookmarks
197
196
198 $ cd ../local
197 $ cd ../local
199 $ echo '[extensions]' >> ../remote/.hg/hgrc
198 $ echo '[extensions]' >> ../remote/.hg/hgrc
200 $ echo 'bookmarks =' >> ../remote/.hg/hgrc
199 $ echo 'bookmarks =' >> ../remote/.hg/hgrc
201 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces
200 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote namespaces
202 bookmarks
201 bookmarks
203 namespaces
202 namespaces
204 $ hg book foo -r 0
203 $ hg book foo -r 0
205 $ hg out -B
204 $ hg out -B
206 comparing with ssh://user@dummy/remote
205 comparing with ssh://user@dummy/remote
207 searching for changed bookmarks
206 searching for changed bookmarks
208 foo 1160648e36ce
207 foo 1160648e36ce
209 $ hg push -B foo
208 $ hg push -B foo
210 pushing to ssh://user@dummy/remote
209 pushing to ssh://user@dummy/remote
211 searching for changes
210 searching for changes
212 no changes found
211 no changes found
213 exporting bookmark foo
212 exporting bookmark foo
214 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks
213 $ hg debugpushkey --config ui.ssh="python ../dummyssh" ssh://user@dummy/remote bookmarks
215 foo 1160648e36cec0054048a7edc4110c6f84fde594
214 foo 1160648e36cec0054048a7edc4110c6f84fde594
216 $ hg book -f foo
215 $ hg book -f foo
217 $ hg push --traceback
216 $ hg push --traceback
218 pushing to ssh://user@dummy/remote
217 pushing to ssh://user@dummy/remote
219 searching for changes
218 searching for changes
220 no changes found
219 no changes found
221 updating bookmark foo
220 updating bookmark foo
222 $ hg book -d foo
221 $ hg book -d foo
223 $ hg in -B
222 $ hg in -B
224 comparing with ssh://user@dummy/remote
223 comparing with ssh://user@dummy/remote
225 searching for changed bookmarks
224 searching for changed bookmarks
226 foo a28a9d1a809c
225 foo a28a9d1a809c
227 $ hg book -f -r 0 foo
226 $ hg book -f -r 0 foo
228 $ hg pull -B foo
227 $ hg pull -B foo
229 pulling from ssh://user@dummy/remote
228 pulling from ssh://user@dummy/remote
230 searching for changes
229 searching for changes
231 no changes found
230 no changes found
232 updating bookmark foo
231 updating bookmark foo
233 importing bookmark foo
232 importing bookmark foo
234 $ hg book -d foo
233 $ hg book -d foo
235 $ hg push -B foo
234 $ hg push -B foo
236 pushing to ssh://user@dummy/remote
235 pushing to ssh://user@dummy/remote
237 searching for changes
236 searching for changes
238 no changes found
237 no changes found
239 deleting remote bookmark foo
238 deleting remote bookmark foo
240
239
241 a bad, evil hook that prints to stdout
240 a bad, evil hook that prints to stdout
242
241
243 $ echo '[hooks]' >> ../remote/.hg/hgrc
242 $ echo '[hooks]' >> ../remote/.hg/hgrc
244 $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc
243 $ echo 'changegroup.stdout = python ../badhook' >> ../remote/.hg/hgrc
245 $ echo r > r
244 $ echo r > r
246 $ hg ci -A -m z r
245 $ hg ci -A -m z r
247
246
248 push should succeed even though it has an unexpected response
247 push should succeed even though it has an unexpected response
249
248
250 $ hg push
249 $ hg push
251 pushing to ssh://user@dummy/remote
250 pushing to ssh://user@dummy/remote
252 searching for changes
251 searching for changes
253 note: unsynced remote changes!
252 note: unsynced remote changes!
254 remote: adding changesets
253 remote: adding changesets
255 remote: adding manifests
254 remote: adding manifests
256 remote: adding file changes
255 remote: adding file changes
257 remote: added 1 changesets with 1 changes to 1 files
256 remote: added 1 changesets with 1 changes to 1 files
258 remote: KABOOM
257 remote: KABOOM
259 $ hg -R ../remote heads
258 $ hg -R ../remote heads
260 changeset: 3:1383141674ec
259 changeset: 3:1383141674ec
261 tag: tip
260 tag: tip
262 parent: 1:a28a9d1a809c
261 parent: 1:a28a9d1a809c
263 user: test
262 user: test
264 date: Thu Jan 01 00:00:00 1970 +0000
263 date: Thu Jan 01 00:00:00 1970 +0000
265 summary: z
264 summary: z
266
265
267 changeset: 2:6c0482d977a3
266 changeset: 2:6c0482d977a3
268 parent: 0:1160648e36ce
267 parent: 0:1160648e36ce
269 user: test
268 user: test
270 date: Thu Jan 01 00:00:00 1970 +0000
269 date: Thu Jan 01 00:00:00 1970 +0000
271 summary: z
270 summary: z
272
271
273 $ cd ..
272 $ cd ..
274 $ cat dummylog
273 $ cat dummylog
275 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
274 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
276 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
275 Got arguments 1:user@dummy 2:hg -R /$TESTTMP/nonexistent serve --stdio
277 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
276 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
278 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
277 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
279 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
278 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
280 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
279 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
281 Got arguments 1:user@dummy 2:hg -R local serve --stdio
280 Got arguments 1:user@dummy 2:hg -R local serve --stdio
282 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
281 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
283 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
282 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
284 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
283 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
285 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
284 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
286 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
285 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
287 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
286 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
288 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
287 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
289 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
288 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
290 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
289 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
291 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
290 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
292 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
291 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
@@ -1,157 +1,156 b''
1
1
2 $ cp "$TESTDIR"/printenv.py .
3 $ hg clone http://localhost:$HGPORT/ copy
2 $ hg clone http://localhost:$HGPORT/ copy
4 abort: error: Connection refused
3 abort: error: Connection refused
5 [255]
4 [255]
6 $ test -d copy
5 $ test -d copy
7 [1]
6 [1]
8
7
9 This server doesn't do range requests so it's basically only good for
8 This server doesn't do range requests so it's basically only good for
10 one pull
9 one pull
11
10
12 $ cat > dumb.py <<EOF
11 $ cat > dumb.py <<EOF
13 > import BaseHTTPServer, SimpleHTTPServer, os, signal, sys
12 > import BaseHTTPServer, SimpleHTTPServer, os, signal, sys
14 >
13 >
15 > def run(server_class=BaseHTTPServer.HTTPServer,
14 > def run(server_class=BaseHTTPServer.HTTPServer,
16 > handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
15 > handler_class=SimpleHTTPServer.SimpleHTTPRequestHandler):
17 > server_address = ('localhost', int(os.environ['HGPORT']))
16 > server_address = ('localhost', int(os.environ['HGPORT']))
18 > httpd = server_class(server_address, handler_class)
17 > httpd = server_class(server_address, handler_class)
19 > httpd.serve_forever()
18 > httpd.serve_forever()
20 >
19 >
21 > signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
20 > signal.signal(signal.SIGTERM, lambda x, y: sys.exit(0))
22 > run()
21 > run()
23 > EOF
22 > EOF
24 $ python dumb.py 2>/dev/null &
23 $ python dumb.py 2>/dev/null &
25 $ echo $! >> $DAEMON_PIDS
24 $ echo $! >> $DAEMON_PIDS
26 $ mkdir remote
25 $ mkdir remote
27 $ cd remote
26 $ cd remote
28 $ hg init
27 $ hg init
29 $ echo foo > bar
28 $ echo foo > bar
30 $ echo c2 > '.dotfile with spaces'
29 $ echo c2 > '.dotfile with spaces'
31 $ hg add
30 $ hg add
32 adding .dotfile with spaces
31 adding .dotfile with spaces
33 adding bar
32 adding bar
34 $ hg commit -m"test"
33 $ hg commit -m"test"
35 $ hg tip
34 $ hg tip
36 changeset: 0:02770d679fb8
35 changeset: 0:02770d679fb8
37 tag: tip
36 tag: tip
38 user: test
37 user: test
39 date: Thu Jan 01 00:00:00 1970 +0000
38 date: Thu Jan 01 00:00:00 1970 +0000
40 summary: test
39 summary: test
41
40
42 $ cd ..
41 $ cd ..
43 $ hg clone static-http://localhost:$HGPORT/remote local
42 $ hg clone static-http://localhost:$HGPORT/remote local
44 requesting all changes
43 requesting all changes
45 adding changesets
44 adding changesets
46 adding manifests
45 adding manifests
47 adding file changes
46 adding file changes
48 added 1 changesets with 2 changes to 2 files
47 added 1 changesets with 2 changes to 2 files
49 updating to branch default
48 updating to branch default
50 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
49 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 $ cd local
50 $ cd local
52 $ hg verify
51 $ hg verify
53 checking changesets
52 checking changesets
54 checking manifests
53 checking manifests
55 crosschecking files in changesets and manifests
54 crosschecking files in changesets and manifests
56 checking files
55 checking files
57 2 files, 1 changesets, 2 total revisions
56 2 files, 1 changesets, 2 total revisions
58 $ cat bar
57 $ cat bar
59 foo
58 foo
60 $ cd ../remote
59 $ cd ../remote
61 $ echo baz > quux
60 $ echo baz > quux
62 $ hg commit -A -mtest2
61 $ hg commit -A -mtest2
63 adding quux
62 adding quux
64
63
65 check for HTTP opener failures when cachefile does not exist
64 check for HTTP opener failures when cachefile does not exist
66
65
67 $ rm .hg/cache/*
66 $ rm .hg/cache/*
68 $ cd ../local
67 $ cd ../local
69 $ echo '[hooks]' >> .hg/hgrc
68 $ echo '[hooks]' >> .hg/hgrc
70 $ echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
69 $ echo 'changegroup = python "$TESTDIR"/printenv.py changegroup' >> .hg/hgrc
71 $ hg pull
70 $ hg pull
72 changegroup hook: HG_NODE=4ac2e3648604439c580c69b09ec9d93a88d93432 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/remote
71 changegroup hook: HG_NODE=4ac2e3648604439c580c69b09ec9d93a88d93432 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/remote
73 pulling from static-http://localhost:$HGPORT/remote
72 pulling from static-http://localhost:$HGPORT/remote
74 searching for changes
73 searching for changes
75 adding changesets
74 adding changesets
76 adding manifests
75 adding manifests
77 adding file changes
76 adding file changes
78 added 1 changesets with 1 changes to 1 files
77 added 1 changesets with 1 changes to 1 files
79 (run 'hg update' to get a working copy)
78 (run 'hg update' to get a working copy)
80
79
81 trying to push
80 trying to push
82
81
83 $ hg update
82 $ hg update
84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 $ echo more foo >> bar
84 $ echo more foo >> bar
86 $ hg commit -m"test"
85 $ hg commit -m"test"
87 $ hg push
86 $ hg push
88 pushing to static-http://localhost:$HGPORT/remote
87 pushing to static-http://localhost:$HGPORT/remote
89 abort: cannot lock static-http repository
88 abort: cannot lock static-http repository
90 [255]
89 [255]
91
90
92 trying clone -r
91 trying clone -r
93
92
94 $ cd ..
93 $ cd ..
95 $ hg clone -r donotexist static-http://localhost:$HGPORT/remote local0
94 $ hg clone -r donotexist static-http://localhost:$HGPORT/remote local0
96 abort: unknown revision 'donotexist'!
95 abort: unknown revision 'donotexist'!
97 [255]
96 [255]
98 $ hg clone -r 0 static-http://localhost:$HGPORT/remote local0
97 $ hg clone -r 0 static-http://localhost:$HGPORT/remote local0
99 adding changesets
98 adding changesets
100 adding manifests
99 adding manifests
101 adding file changes
100 adding file changes
102 added 1 changesets with 2 changes to 2 files
101 added 1 changesets with 2 changes to 2 files
103 updating to branch default
102 updating to branch default
104 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
103 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
105
104
106 test with "/" URI (issue 747)
105 test with "/" URI (issue 747)
107
106
108 $ hg init
107 $ hg init
109 $ echo a > a
108 $ echo a > a
110 $ hg add a
109 $ hg add a
111 $ hg ci -ma
110 $ hg ci -ma
112 $ hg clone static-http://localhost:$HGPORT/ local2
111 $ hg clone static-http://localhost:$HGPORT/ local2
113 requesting all changes
112 requesting all changes
114 adding changesets
113 adding changesets
115 adding manifests
114 adding manifests
116 adding file changes
115 adding file changes
117 added 1 changesets with 1 changes to 1 files
116 added 1 changesets with 1 changes to 1 files
118 updating to branch default
117 updating to branch default
119 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
118 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
120 $ cd local2
119 $ cd local2
121 $ hg verify
120 $ hg verify
122 checking changesets
121 checking changesets
123 checking manifests
122 checking manifests
124 crosschecking files in changesets and manifests
123 crosschecking files in changesets and manifests
125 checking files
124 checking files
126 1 files, 1 changesets, 1 total revisions
125 1 files, 1 changesets, 1 total revisions
127 $ cat a
126 $ cat a
128 a
127 a
129 $ hg paths
128 $ hg paths
130 default = static-http://localhost:$HGPORT/
129 default = static-http://localhost:$HGPORT/
131
130
132 test with empty repo (issue965)
131 test with empty repo (issue965)
133
132
134 $ cd ..
133 $ cd ..
135 $ hg init remotempty
134 $ hg init remotempty
136 $ hg clone static-http://localhost:$HGPORT/remotempty local3
135 $ hg clone static-http://localhost:$HGPORT/remotempty local3
137 no changes found
136 no changes found
138 updating to branch default
137 updating to branch default
139 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
138 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
140 $ cd local3
139 $ cd local3
141 $ hg verify
140 $ hg verify
142 checking changesets
141 checking changesets
143 checking manifests
142 checking manifests
144 crosschecking files in changesets and manifests
143 crosschecking files in changesets and manifests
145 checking files
144 checking files
146 0 files, 0 changesets, 0 total revisions
145 0 files, 0 changesets, 0 total revisions
147 $ hg paths
146 $ hg paths
148 default = static-http://localhost:$HGPORT/remotempty
147 default = static-http://localhost:$HGPORT/remotempty
149
148
150 test with non-repo
149 test with non-repo
151
150
152 $ cd ..
151 $ cd ..
153 $ mkdir notarepo
152 $ mkdir notarepo
154 $ hg clone static-http://localhost:$HGPORT/notarepo local3
153 $ hg clone static-http://localhost:$HGPORT/notarepo local3
155 abort: 'http://localhost:$HGPORT/notarepo' does not appear to be an hg repository!
154 abort: 'http://localhost:$HGPORT/notarepo' does not appear to be an hg repository!
156 [255]
155 [255]
157 $ kill $!
156 $ kill $!
General Comments 0
You need to be logged in to leave comments. Login now