##// END OF EJS Templates
tests: Adapt expected output for minor differences with rhg...
Simon Sapin -
r47471:e96a0a53 default
parent child Browse files
Show More
@@ -1,564 +1,564 b''
1 1 $ hg init a
2 2 $ cd a
3 3 $ echo a > a
4 4 $ hg ci -A -d'1 0' -m a
5 5 adding a
6 6
7 7 $ cd ..
8 8
9 9 $ hg init b
10 10 $ cd b
11 11 $ echo b > b
12 12 $ hg ci -A -d'1 0' -m b
13 13 adding b
14 14
15 15 $ cd ..
16 16
17 17 $ hg clone a c
18 18 updating to branch default
19 19 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 20 $ cd c
21 21 $ cat >> .hg/hgrc <<EOF
22 22 > [paths]
23 23 > relative = ../a
24 24 > EOF
25 25 $ hg pull -f ../b
26 26 pulling from ../b
27 27 searching for changes
28 28 warning: repository is unrelated
29 29 requesting all changes
30 30 adding changesets
31 31 adding manifests
32 32 adding file changes
33 33 added 1 changesets with 1 changes to 1 files (+1 heads)
34 34 new changesets b6c483daf290
35 35 (run 'hg heads' to see heads, 'hg merge' to merge)
36 36 $ hg merge
37 37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 38 (branch merge, don't forget to commit)
39 39
40 40 $ cd ..
41 41
42 42 Testing -R/--repository:
43 43
44 44 $ hg -R a tip
45 45 changeset: 0:8580ff50825a
46 46 tag: tip
47 47 user: test
48 48 date: Thu Jan 01 00:00:01 1970 +0000
49 49 summary: a
50 50
51 51 $ hg --repository b tip
52 52 changeset: 0:b6c483daf290
53 53 tag: tip
54 54 user: test
55 55 date: Thu Jan 01 00:00:01 1970 +0000
56 56 summary: b
57 57
58 58
59 59 -R with a URL:
60 60
61 61 $ hg -R file:a identify
62 62 8580ff50825a tip
63 63 $ hg -R file://localhost/`pwd`/a/ identify
64 64 8580ff50825a tip
65 65
66 66 -R with path aliases:
67 67
68 68 $ cd c
69 69 $ hg -R default identify
70 70 8580ff50825a tip
71 71 $ hg -R relative identify
72 72 8580ff50825a tip
73 73 $ echo '[paths]' >> $HGRCPATH
74 74 $ echo 'relativetohome = a' >> $HGRCPATH
75 75 $ HOME=`pwd`/../ hg -R relativetohome identify
76 76 8580ff50825a tip
77 77 $ cd ..
78 78
79 79 #if no-outer-repo
80 80
81 81 Implicit -R:
82 82
83 83 $ hg ann a/a
84 84 0: a
85 85 $ hg ann a/a a/a
86 86 0: a
87 87 $ hg ann a/a b/b
88 88 abort: no repository found in '$TESTTMP' (.hg not found)
89 89 [10]
90 90 $ hg -R b ann a/a
91 91 abort: a/a not under root '$TESTTMP/b'
92 92 (consider using '--cwd b')
93 93 [255]
94 94 $ hg log
95 95 abort: no repository found in '$TESTTMP' (.hg not found)
96 96 [10]
97 97
98 98 #endif
99 99
100 100 Abbreviation of long option:
101 101
102 102 $ hg --repo c tip
103 103 changeset: 1:b6c483daf290
104 104 tag: tip
105 105 parent: -1:000000000000
106 106 user: test
107 107 date: Thu Jan 01 00:00:01 1970 +0000
108 108 summary: b
109 109
110 110
111 111 earlygetopt with duplicate options (36d23de02da1):
112 112
113 113 $ hg --cwd a --cwd b --cwd c tip
114 114 changeset: 1:b6c483daf290
115 115 tag: tip
116 116 parent: -1:000000000000
117 117 user: test
118 118 date: Thu Jan 01 00:00:01 1970 +0000
119 119 summary: b
120 120
121 121 $ hg --repo c --repository b -R a tip
122 122 changeset: 0:8580ff50825a
123 123 tag: tip
124 124 user: test
125 125 date: Thu Jan 01 00:00:01 1970 +0000
126 126 summary: a
127 127
128 128
129 129 earlygetopt short option without following space:
130 130
131 131 $ hg -q -Rb tip
132 132 0:b6c483daf290
133 133
134 134 earlygetopt with illegal abbreviations:
135 135
136 136 $ hg --confi "foo.bar=baz"
137 137 abort: option --config may not be abbreviated
138 138 [10]
139 139 $ hg --cw a tip
140 140 abort: option --cwd may not be abbreviated
141 141 [10]
142 142 $ hg --rep a tip
143 143 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
144 144 [10]
145 145 $ hg --repositor a tip
146 146 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
147 147 [10]
148 148 $ hg -qR a tip
149 149 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
150 150 [10]
151 151 $ hg -qRa tip
152 152 abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo
153 153 [10]
154 154
155 155 Testing --cwd:
156 156
157 157 $ hg --cwd a parents
158 158 changeset: 0:8580ff50825a
159 159 tag: tip
160 160 user: test
161 161 date: Thu Jan 01 00:00:01 1970 +0000
162 162 summary: a
163 163
164 164
165 165 Testing -y/--noninteractive - just be sure it is parsed:
166 166
167 167 $ hg --cwd a tip -q --noninteractive
168 168 0:8580ff50825a
169 169 $ hg --cwd a tip -q -y
170 170 0:8580ff50825a
171 171
172 172 Testing -q/--quiet:
173 173
174 174 $ hg -R a -q tip
175 175 0:8580ff50825a
176 176 $ hg -R b -q tip
177 177 0:b6c483daf290
178 178 $ hg -R c --quiet parents
179 179 0:8580ff50825a
180 180 1:b6c483daf290
181 181
182 182 Testing -v/--verbose:
183 183
184 184 $ hg --cwd c head -v
185 185 changeset: 1:b6c483daf290
186 186 tag: tip
187 187 parent: -1:000000000000
188 188 user: test
189 189 date: Thu Jan 01 00:00:01 1970 +0000
190 190 files: b
191 191 description:
192 192 b
193 193
194 194
195 195 changeset: 0:8580ff50825a
196 196 user: test
197 197 date: Thu Jan 01 00:00:01 1970 +0000
198 198 files: a
199 199 description:
200 200 a
201 201
202 202
203 203 $ hg --cwd b tip --verbose
204 204 changeset: 0:b6c483daf290
205 205 tag: tip
206 206 user: test
207 207 date: Thu Jan 01 00:00:01 1970 +0000
208 208 files: b
209 209 description:
210 210 b
211 211
212 212
213 213
214 214 Testing --config:
215 215
216 216 $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo
217 217 quuxfoo
218 218 $ hg --cwd c --config '' tip -q
219 219 abort: malformed --config option: '' (use --config section.name=value)
220 220 [10]
221 221 $ hg --cwd c --config a.b tip -q
222 222 abort: malformed --config option: 'a.b' (use --config section.name=value)
223 223 [10]
224 224 $ hg --cwd c --config a tip -q
225 225 abort: malformed --config option: 'a' (use --config section.name=value)
226 226 [10]
227 227 $ hg --cwd c --config a.= tip -q
228 228 abort: malformed --config option: 'a.=' (use --config section.name=value)
229 229 [10]
230 230 $ hg --cwd c --config .b= tip -q
231 231 abort: malformed --config option: '.b=' (use --config section.name=value)
232 232 [10]
233 233
234 234 Testing --debug:
235 235
236 236 $ hg --cwd c log --debug
237 237 changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a
238 238 tag: tip
239 239 phase: public
240 240 parent: -1:0000000000000000000000000000000000000000
241 241 parent: -1:0000000000000000000000000000000000000000
242 242 manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49
243 243 user: test
244 244 date: Thu Jan 01 00:00:01 1970 +0000
245 245 files+: b
246 246 extra: branch=default
247 247 description:
248 248 b
249 249
250 250
251 251 changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab
252 252 phase: public
253 253 parent: -1:0000000000000000000000000000000000000000
254 254 parent: -1:0000000000000000000000000000000000000000
255 255 manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0
256 256 user: test
257 257 date: Thu Jan 01 00:00:01 1970 +0000
258 258 files+: a
259 259 extra: branch=default
260 260 description:
261 261 a
262 262
263 263
264 264
265 265 Testing --traceback:
266 266
267 #if no-chg
267 #if no-chg no-rhg
268 268 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
269 269 Traceback (most recent call last):
270 270 Traceback (most recent call last): (py3 !)
271 271 #else
272 272 Traceback for '--config' errors not supported with chg.
273 273 $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback'
274 274 [1]
275 275 #endif
276 276
277 277 Testing --time:
278 278
279 279 $ hg --cwd a --time id
280 280 8580ff50825a tip
281 281 time: real * (glob)
282 282
283 283 Testing --version:
284 284
285 285 $ hg --version -q
286 286 Mercurial Distributed SCM * (glob)
287 287
288 288 hide outer repo
289 289 $ hg init
290 290
291 291 Testing -h/--help:
292 292
293 293 #if no-extraextensions
294 294
295 295 $ hg -h
296 296 Mercurial Distributed SCM
297 297
298 298 list of commands:
299 299
300 300 Repository creation:
301 301
302 302 clone make a copy of an existing repository
303 303 init create a new repository in the given directory
304 304
305 305 Remote repository management:
306 306
307 307 incoming show new changesets found in source
308 308 outgoing show changesets not found in the destination
309 309 paths show aliases for remote repositories
310 310 pull pull changes from the specified source
311 311 push push changes to the specified destination
312 312 serve start stand-alone webserver
313 313
314 314 Change creation:
315 315
316 316 commit commit the specified files or all outstanding changes
317 317
318 318 Change manipulation:
319 319
320 320 backout reverse effect of earlier changeset
321 321 graft copy changes from other branches onto the current branch
322 322 merge merge another revision into working directory
323 323
324 324 Change organization:
325 325
326 326 bookmarks create a new bookmark or list existing bookmarks
327 327 branch set or show the current branch name
328 328 branches list repository named branches
329 329 phase set or show the current phase name
330 330 tag add one or more tags for the current or given revision
331 331 tags list repository tags
332 332
333 333 File content management:
334 334
335 335 annotate show changeset information by line for each file
336 336 cat output the current or given revision of files
337 337 copy mark files as copied for the next commit
338 338 diff diff repository (or selected files)
339 339 grep search for a pattern in specified files
340 340
341 341 Change navigation:
342 342
343 343 bisect subdivision search of changesets
344 344 heads show branch heads
345 345 identify identify the working directory or specified revision
346 346 log show revision history of entire repository or files
347 347
348 348 Working directory management:
349 349
350 350 add add the specified files on the next commit
351 351 addremove add all new files, delete all missing files
352 352 files list tracked files
353 353 forget forget the specified files on the next commit
354 354 purge removes files not tracked by Mercurial
355 355 remove remove the specified files on the next commit
356 356 rename rename files; equivalent of copy + remove
357 357 resolve redo merges or set/view the merge status of files
358 358 revert restore files to their checkout state
359 359 root print the root (top) of the current working directory
360 360 shelve save and set aside changes from the working directory
361 361 status show changed files in the working directory
362 362 summary summarize working directory state
363 363 unshelve restore a shelved change to the working directory
364 364 update update working directory (or switch revisions)
365 365
366 366 Change import/export:
367 367
368 368 archive create an unversioned archive of a repository revision
369 369 bundle create a bundle file
370 370 export dump the header and diffs for one or more changesets
371 371 import import an ordered set of patches
372 372 unbundle apply one or more bundle files
373 373
374 374 Repository maintenance:
375 375
376 376 manifest output the current or given revision of the project manifest
377 377 recover roll back an interrupted transaction
378 378 verify verify the integrity of the repository
379 379
380 380 Help:
381 381
382 382 config show combined config settings from all hgrc files
383 383 help show help for a given topic or a help overview
384 384 version output version and copyright information
385 385
386 386 additional help topics:
387 387
388 388 Mercurial identifiers:
389 389
390 390 filesets Specifying File Sets
391 391 hgignore Syntax for Mercurial Ignore Files
392 392 patterns File Name Patterns
393 393 revisions Specifying Revisions
394 394 urls URL Paths
395 395
396 396 Mercurial output:
397 397
398 398 color Colorizing Outputs
399 399 dates Date Formats
400 400 diffs Diff Formats
401 401 templating Template Usage
402 402
403 403 Mercurial configuration:
404 404
405 405 config Configuration Files
406 406 environment Environment Variables
407 407 extensions Using Additional Features
408 408 flags Command-line flags
409 409 hgweb Configuring hgweb
410 410 merge-tools Merge Tools
411 411 pager Pager Support
412 412
413 413 Concepts:
414 414
415 415 bundlespec Bundle File Formats
416 416 glossary Glossary
417 417 phases Working with Phases
418 418 subrepos Subrepositories
419 419
420 420 Miscellaneous:
421 421
422 422 deprecated Deprecated Features
423 423 internals Technical implementation topics
424 424 scripting Using Mercurial from scripts and automation
425 425
426 426 (use 'hg help -v' to show built-in aliases and global options)
427 427
428 428 $ hg --help
429 429 Mercurial Distributed SCM
430 430
431 431 list of commands:
432 432
433 433 Repository creation:
434 434
435 435 clone make a copy of an existing repository
436 436 init create a new repository in the given directory
437 437
438 438 Remote repository management:
439 439
440 440 incoming show new changesets found in source
441 441 outgoing show changesets not found in the destination
442 442 paths show aliases for remote repositories
443 443 pull pull changes from the specified source
444 444 push push changes to the specified destination
445 445 serve start stand-alone webserver
446 446
447 447 Change creation:
448 448
449 449 commit commit the specified files or all outstanding changes
450 450
451 451 Change manipulation:
452 452
453 453 backout reverse effect of earlier changeset
454 454 graft copy changes from other branches onto the current branch
455 455 merge merge another revision into working directory
456 456
457 457 Change organization:
458 458
459 459 bookmarks create a new bookmark or list existing bookmarks
460 460 branch set or show the current branch name
461 461 branches list repository named branches
462 462 phase set or show the current phase name
463 463 tag add one or more tags for the current or given revision
464 464 tags list repository tags
465 465
466 466 File content management:
467 467
468 468 annotate show changeset information by line for each file
469 469 cat output the current or given revision of files
470 470 copy mark files as copied for the next commit
471 471 diff diff repository (or selected files)
472 472 grep search for a pattern in specified files
473 473
474 474 Change navigation:
475 475
476 476 bisect subdivision search of changesets
477 477 heads show branch heads
478 478 identify identify the working directory or specified revision
479 479 log show revision history of entire repository or files
480 480
481 481 Working directory management:
482 482
483 483 add add the specified files on the next commit
484 484 addremove add all new files, delete all missing files
485 485 files list tracked files
486 486 forget forget the specified files on the next commit
487 487 purge removes files not tracked by Mercurial
488 488 remove remove the specified files on the next commit
489 489 rename rename files; equivalent of copy + remove
490 490 resolve redo merges or set/view the merge status of files
491 491 revert restore files to their checkout state
492 492 root print the root (top) of the current working directory
493 493 shelve save and set aside changes from the working directory
494 494 status show changed files in the working directory
495 495 summary summarize working directory state
496 496 unshelve restore a shelved change to the working directory
497 497 update update working directory (or switch revisions)
498 498
499 499 Change import/export:
500 500
501 501 archive create an unversioned archive of a repository revision
502 502 bundle create a bundle file
503 503 export dump the header and diffs for one or more changesets
504 504 import import an ordered set of patches
505 505 unbundle apply one or more bundle files
506 506
507 507 Repository maintenance:
508 508
509 509 manifest output the current or given revision of the project manifest
510 510 recover roll back an interrupted transaction
511 511 verify verify the integrity of the repository
512 512
513 513 Help:
514 514
515 515 config show combined config settings from all hgrc files
516 516 help show help for a given topic or a help overview
517 517 version output version and copyright information
518 518
519 519 additional help topics:
520 520
521 521 Mercurial identifiers:
522 522
523 523 filesets Specifying File Sets
524 524 hgignore Syntax for Mercurial Ignore Files
525 525 patterns File Name Patterns
526 526 revisions Specifying Revisions
527 527 urls URL Paths
528 528
529 529 Mercurial output:
530 530
531 531 color Colorizing Outputs
532 532 dates Date Formats
533 533 diffs Diff Formats
534 534 templating Template Usage
535 535
536 536 Mercurial configuration:
537 537
538 538 config Configuration Files
539 539 environment Environment Variables
540 540 extensions Using Additional Features
541 541 flags Command-line flags
542 542 hgweb Configuring hgweb
543 543 merge-tools Merge Tools
544 544 pager Pager Support
545 545
546 546 Concepts:
547 547
548 548 bundlespec Bundle File Formats
549 549 glossary Glossary
550 550 phases Working with Phases
551 551 subrepos Subrepositories
552 552
553 553 Miscellaneous:
554 554
555 555 deprecated Deprecated Features
556 556 internals Technical implementation topics
557 557 scripting Using Mercurial from scripts and automation
558 558
559 559 (use 'hg help -v' to show built-in aliases and global options)
560 560
561 561 #endif
562 562
563 563 Not tested: --debugger
564 564
@@ -1,308 +1,308 b''
1 1 Use hgrc within $TESTTMP
2 2
3 3 $ HGRCPATH=`pwd`/hgrc
4 4 $ export HGRCPATH
5 5
6 6 hide outer repo
7 7 $ hg init
8 8
9 9 Use an alternate var for scribbling on hgrc to keep check-code from
10 10 complaining about the important settings we may be overwriting:
11 11
12 12 $ HGRC=`pwd`/hgrc
13 13 $ export HGRC
14 14
15 15 Basic syntax error
16 16
17 17 $ echo "invalid" > $HGRC
18 18 $ hg version
19 19 config error at $TESTTMP/hgrc:1: invalid
20 20 [255]
21 21 $ echo "" > $HGRC
22 22
23 23 Issue1199: Can't use '%' in hgrc (eg url encoded username)
24 24
25 25 $ hg init "foo%bar"
26 26 $ hg clone "foo%bar" foobar
27 27 updating to branch default
28 28 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 29 $ cd foobar
30 30 $ cat .hg/hgrc
31 31 # example repository config (see 'hg help config' for more info)
32 32 [paths]
33 33 default = $TESTTMP/foo%bar
34 34
35 35 # path aliases to other clones of this repo in URLs or filesystem paths
36 36 # (see 'hg help config.paths' for more info)
37 37 #
38 38 # default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork
39 39 # my-fork = ssh://jdoe@example.net/hg/jdoes-fork
40 40 # my-clone = /home/jdoe/jdoes-clone
41 41
42 42 [ui]
43 43 # name and email (local to this repository, optional), e.g.
44 44 # username = Jane Doe <jdoe@example.com>
45 45 $ hg paths
46 46 default = $TESTTMP/foo%bar
47 47 $ hg showconfig
48 48 bundle.mainreporoot=$TESTTMP/foobar
49 49 paths.default=$TESTTMP/foo%bar
50 50 $ cd ..
51 51
52 52 Check %include
53 53
54 54 $ echo '[section]' > $TESTTMP/included
55 55 $ echo 'option = value' >> $TESTTMP/included
56 56 $ echo '%include $TESTTMP/included' >> $HGRC
57 57 $ hg showconfig section
58 58 section.option=value
59 59 #if unix-permissions no-root
60 60 $ chmod u-r $TESTTMP/included
61 61 $ hg showconfig section
62 config error at $TESTTMP/hgrc:2: cannot include $TESTTMP/included (Permission denied)
62 config error at $TESTTMP/hgrc:2: cannot include $TESTTMP/included (Permission denied*) (glob)
63 63 [255]
64 64 #endif
65 65
66 66 issue1829: wrong indentation
67 67
68 68 $ echo '[foo]' > $HGRC
69 69 $ echo ' x = y' >> $HGRC
70 70 $ hg version
71 71 config error at $TESTTMP/hgrc:2: unexpected leading whitespace: x = y
72 72 [255]
73 73
74 74 $ "$PYTHON" -c "from __future__ import print_function; print('[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n')" \
75 75 > > $HGRC
76 76 $ hg showconfig foo
77 77 foo.bar=a\nb\nc\nde\nfg
78 78 foo.baz=bif cb
79 79
80 80 $ FAKEPATH=/path/to/nowhere
81 81 $ export FAKEPATH
82 82 $ echo '%include $FAKEPATH/no-such-file' > $HGRC
83 83 $ hg version
84 84 Mercurial Distributed SCM (version *) (glob)
85 85 (see https://mercurial-scm.org for more information)
86 86
87 87 Copyright (C) 2005-* Matt Mackall and others (glob)
88 88 This is free software; see the source for copying conditions. There is NO
89 89 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
90 90 $ unset FAKEPATH
91 91
92 92 make sure global options given on the cmdline take precedence
93 93
94 94 $ hg showconfig --config ui.verbose=True --quiet
95 95 bundle.mainreporoot=$TESTTMP
96 96 ui.verbose=False
97 97 ui.debug=False
98 98 ui.quiet=True
99 99
100 100 $ touch foobar/untracked
101 101 $ cat >> foobar/.hg/hgrc <<EOF
102 102 > [ui]
103 103 > verbose=True
104 104 > EOF
105 105 $ hg -R foobar st -q
106 106
107 107 username expansion
108 108
109 109 $ olduser=$HGUSER
110 110 $ unset HGUSER
111 111
112 112 $ FAKEUSER='John Doe'
113 113 $ export FAKEUSER
114 114 $ echo '[ui]' > $HGRC
115 115 $ echo 'username = $FAKEUSER' >> $HGRC
116 116
117 117 $ hg init usertest
118 118 $ cd usertest
119 119 $ touch bar
120 120 $ hg commit --addremove --quiet -m "added bar"
121 121 $ hg log --template "{author}\n"
122 122 John Doe
123 123 $ cd ..
124 124
125 125 $ hg showconfig
126 126 bundle.mainreporoot=$TESTTMP
127 127 ui.username=$FAKEUSER
128 128
129 129 $ unset FAKEUSER
130 130 $ HGUSER=$olduser
131 131 $ export HGUSER
132 132
133 133 showconfig with multiple arguments
134 134
135 135 $ echo "[alias]" > $HGRC
136 136 $ echo "log = log -g" >> $HGRC
137 137 $ echo "[defaults]" >> $HGRC
138 138 $ echo "identify = -n" >> $HGRC
139 139 $ hg showconfig alias defaults
140 140 alias.log=log -g
141 141 defaults.identify=-n
142 142 $ hg showconfig alias alias
143 143 alias.log=log -g
144 144 $ hg showconfig alias.log alias.log
145 145 alias.log=log -g
146 146 $ hg showconfig alias defaults.identify
147 147 alias.log=log -g
148 148 defaults.identify=-n
149 149 $ hg showconfig alias.log defaults.identify
150 150 alias.log=log -g
151 151 defaults.identify=-n
152 152
153 153 HGPLAIN
154 154
155 155 $ echo "[ui]" > $HGRC
156 156 $ echo "debug=true" >> $HGRC
157 157 $ echo "fallbackencoding=ASCII" >> $HGRC
158 158 $ echo "quiet=true" >> $HGRC
159 159 $ echo "slash=true" >> $HGRC
160 160 $ echo "traceback=true" >> $HGRC
161 161 $ echo "verbose=true" >> $HGRC
162 162 $ echo "style=~/.hgstyle" >> $HGRC
163 163 $ echo "logtemplate={node}" >> $HGRC
164 164 $ echo "[defaults]" >> $HGRC
165 165 $ echo "identify=-n" >> $HGRC
166 166 $ echo "[alias]" >> $HGRC
167 167 $ echo "log=log -g" >> $HGRC
168 168
169 169 customized hgrc
170 170
171 171 $ hg showconfig
172 172 read config from: $TESTTMP/hgrc
173 173 $TESTTMP/hgrc:13: alias.log=log -g
174 174 repo: bundle.mainreporoot=$TESTTMP
175 175 $TESTTMP/hgrc:11: defaults.identify=-n
176 176 $TESTTMP/hgrc:2: ui.debug=true
177 177 $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII
178 178 $TESTTMP/hgrc:4: ui.quiet=true
179 179 $TESTTMP/hgrc:5: ui.slash=true
180 180 $TESTTMP/hgrc:6: ui.traceback=true
181 181 $TESTTMP/hgrc:7: ui.verbose=true
182 182 $TESTTMP/hgrc:8: ui.style=~/.hgstyle
183 183 $TESTTMP/hgrc:9: ui.logtemplate={node}
184 184
185 185 plain hgrc
186 186
187 187 $ HGPLAIN=; export HGPLAIN
188 188 $ hg showconfig --config ui.traceback=True --debug
189 189 read config from: $TESTTMP/hgrc
190 190 repo: bundle.mainreporoot=$TESTTMP
191 191 --config: ui.traceback=True
192 192 --verbose: ui.verbose=False
193 193 --debug: ui.debug=True
194 194 --quiet: ui.quiet=False
195 195
196 196 with environment variables
197 197
198 198 $ PAGER=p1 EDITOR=e1 VISUAL=e2 hg showconfig --debug
199 199 read config from: $TESTTMP/hgrc
200 200 repo: bundle.mainreporoot=$TESTTMP
201 201 $PAGER: pager.pager=p1
202 202 $VISUAL: ui.editor=e2
203 203 --verbose: ui.verbose=False
204 204 --debug: ui.debug=True
205 205 --quiet: ui.quiet=False
206 206
207 207 plain mode with exceptions
208 208
209 209 $ cat > plain.py <<EOF
210 210 > from mercurial import commands, extensions
211 211 > def _config(orig, ui, repo, *values, **opts):
212 212 > ui.write(b'plain: %r\n' % ui.plain())
213 213 > return orig(ui, repo, *values, **opts)
214 214 > def uisetup(ui):
215 215 > extensions.wrapcommand(commands.table, b'config', _config)
216 216 > EOF
217 217 $ echo "[extensions]" >> $HGRC
218 218 $ echo "plain=./plain.py" >> $HGRC
219 219 $ HGPLAINEXCEPT=; export HGPLAINEXCEPT
220 220 $ hg showconfig --config ui.traceback=True --debug
221 221 plain: True
222 222 read config from: $TESTTMP/hgrc
223 223 repo: bundle.mainreporoot=$TESTTMP
224 224 $TESTTMP/hgrc:15: extensions.plain=./plain.py
225 225 --config: ui.traceback=True
226 226 --verbose: ui.verbose=False
227 227 --debug: ui.debug=True
228 228 --quiet: ui.quiet=False
229 229 $ unset HGPLAIN
230 230 $ hg showconfig --config ui.traceback=True --debug
231 231 plain: True
232 232 read config from: $TESTTMP/hgrc
233 233 repo: bundle.mainreporoot=$TESTTMP
234 234 $TESTTMP/hgrc:15: extensions.plain=./plain.py
235 235 --config: ui.traceback=True
236 236 --verbose: ui.verbose=False
237 237 --debug: ui.debug=True
238 238 --quiet: ui.quiet=False
239 239 $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT
240 240 $ hg showconfig --config ui.traceback=True --debug
241 241 plain: True
242 242 read config from: $TESTTMP/hgrc
243 243 repo: bundle.mainreporoot=$TESTTMP
244 244 $TESTTMP/hgrc:15: extensions.plain=./plain.py
245 245 --config: ui.traceback=True
246 246 --verbose: ui.verbose=False
247 247 --debug: ui.debug=True
248 248 --quiet: ui.quiet=False
249 249
250 250 source of paths is not mangled
251 251
252 252 $ cat >> $HGRCPATH <<EOF
253 253 > [paths]
254 254 > foo = bar
255 255 > EOF
256 256 $ hg showconfig --debug paths
257 257 plain: True
258 258 read config from: $TESTTMP/hgrc
259 259 $TESTTMP/hgrc:17: paths.foo=$TESTTMP/bar
260 260
261 261 Test we can skip the user configuration
262 262
263 263 $ cat >> .hg/hgrc <<EOF
264 264 > [paths]
265 265 > elephant = babar
266 266 > EOF
267 267 $ hg path
268 268 elephant = $TESTTMP/babar
269 269 foo = $TESTTMP/bar
270 270 $ HGRCSKIPREPO=1 hg path
271 271 foo = $TESTTMP/bar
272 272
273 273 $ cat >> .hg/hgrc <<EOF
274 274 > [broken
275 275 > EOF
276 276
277 277 $ hg path
278 278 config error at $TESTTMP/.hg/hgrc:3: [broken
279 279 [255]
280 280 $ HGRCSKIPREPO=1 hg path
281 281 foo = $TESTTMP/bar
282 282
283 283 Check that hgweb respect HGRCSKIPREPO=1
284 284
285 285 $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
286 286 config error at $TESTTMP/.hg/hgrc:3: [broken
287 287 [255]
288 288 $ test -f hg.pid && (cat hg.pid >> $DAEMON_PIDS)
289 289 [1]
290 290 $ killdaemons.py
291 291 $ test -f access.log && cat access.log
292 292 [1]
293 293 $ test -f errors.log && cat errors.log
294 294 [1]
295 295
296 296 $ HGRCSKIPREPO=1 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
297 297 $ cat hg.pid >> $DAEMON_PIDS
298 298 $ killdaemons.py
299 299 $ cat access.log
300 300 $ cat errors.log
301 301
302 302 Check that zeroconf respect HGRCSKIPREPO=1
303 303
304 304 $ hg paths --config extensions.zeroconf=
305 305 config error at $TESTTMP/.hg/hgrc:3: [broken
306 306 [255]
307 307 $ HGRCSKIPREPO=1 hg paths --config extensions.zeroconf=
308 308 foo = $TESTTMP/bar
@@ -1,707 +1,729 b''
1 1 #testcases sshv1 sshv2
2 2
3 3 #if sshv2
4 4 $ cat >> $HGRCPATH << EOF
5 5 > [experimental]
6 6 > sshpeer.advertise-v2 = true
7 7 > sshserver.support-v2 = true
8 8 > EOF
9 9 #endif
10 10
11 11 This test tries to exercise the ssh functionality with a dummy script
12 12
13 13 creating 'remote' repo
14 14
15 15 $ hg init remote
16 16 $ cd remote
17 17 $ echo this > foo
18 18 $ echo this > fooO
19 19 $ hg ci -A -m "init" foo fooO
20 20
21 21 insert a closed branch (issue4428)
22 22
23 23 $ hg up null
24 24 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
25 25 $ hg branch closed
26 26 marked working directory as branch closed
27 27 (branches are permanent and global, did you want a bookmark?)
28 28 $ hg ci -mc0
29 29 $ hg ci --close-branch -mc1
30 30 $ hg up -q default
31 31
32 32 configure for serving
33 33
34 34 $ cat <<EOF > .hg/hgrc
35 35 > [server]
36 36 > uncompressed = True
37 37 >
38 38 > [hooks]
39 39 > changegroup = sh -c "printenv.py --line changegroup-in-remote 0 ../dummylog"
40 40 > EOF
41 41 $ cd $TESTTMP
42 42
43 43 repo not found error
44 44
45 45 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
46 46 remote: abort: repository nonexistent not found
47 47 abort: no suitable response from remote hg
48 48 [255]
49 49 $ hg clone -q -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/nonexistent local
50 50 remote: abort: repository nonexistent not found
51 51 abort: no suitable response from remote hg
52 52 [255]
53 53
54 54 non-existent absolute path
55 55
56 56 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/`pwd`/nonexistent local
57 57 remote: abort: repository $TESTTMP/nonexistent not found
58 58 abort: no suitable response from remote hg
59 59 [255]
60 60
61 61 clone remote via stream
62 62
63 63 #if no-reposimplestore
64 64
65 65 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/remote local-stream
66 66 streaming all changes
67 67 8 files to transfer, 827 bytes of data
68 68 transferred 827 bytes in * seconds (*) (glob)
69 69 updating to branch default
70 70 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
71 71 $ cd local-stream
72 72 $ hg verify
73 73 checking changesets
74 74 checking manifests
75 75 crosschecking files in changesets and manifests
76 76 checking files
77 77 checked 3 changesets with 2 changes to 2 files
78 78 $ hg branches
79 79 default 0:1160648e36ce
80 80 $ cd $TESTTMP
81 81
82 82 clone bookmarks via stream
83 83
84 84 $ hg -R local-stream book mybook
85 85 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" --stream ssh://user@dummy/local-stream stream2
86 86 streaming all changes
87 87 16 files to transfer, * of data (glob)
88 88 transferred * in * seconds (*) (glob)
89 89 updating to branch default
90 90 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 91 $ cd stream2
92 92 $ hg book
93 93 mybook 0:1160648e36ce
94 94 $ cd $TESTTMP
95 95 $ rm -rf local-stream stream2
96 96
97 97 #endif
98 98
99 99 clone remote via pull
100 100
101 101 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local
102 102 requesting all changes
103 103 adding changesets
104 104 adding manifests
105 105 adding file changes
106 106 added 3 changesets with 2 changes to 2 files
107 107 new changesets 1160648e36ce:ad076bfb429d
108 108 updating to branch default
109 109 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 110
111 111 verify
112 112
113 113 $ cd local
114 114 $ hg verify
115 115 checking changesets
116 116 checking manifests
117 117 crosschecking files in changesets and manifests
118 118 checking files
119 119 checked 3 changesets with 2 changes to 2 files
120 120 $ cat >> .hg/hgrc <<EOF
121 121 > [hooks]
122 122 > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog"
123 123 > EOF
124 124
125 125 empty default pull
126 126
127 127 $ hg paths
128 128 default = ssh://user@dummy/remote
129 129 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
130 130 pulling from ssh://user@dummy/remote
131 131 searching for changes
132 132 no changes found
133 133
134 134 pull from wrong ssh URL
135 135
136 136 $ hg pull -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/doesnotexist
137 137 pulling from ssh://user@dummy/doesnotexist
138 138 remote: abort: repository doesnotexist not found
139 139 abort: no suitable response from remote hg
140 140 [255]
141 141
142 142 local change
143 143
144 144 $ echo bleah > foo
145 145 $ hg ci -m "add"
146 146
147 147 updating rc
148 148
149 149 $ echo "default-push = ssh://user@dummy/remote" >> .hg/hgrc
150 150 $ echo "[ui]" >> .hg/hgrc
151 151 $ echo "ssh = \"$PYTHON\" \"$TESTDIR/dummyssh\"" >> .hg/hgrc
152 152
153 153 find outgoing
154 154
155 155 $ hg out ssh://user@dummy/remote
156 156 comparing with ssh://user@dummy/remote
157 157 searching for changes
158 158 changeset: 3:a28a9d1a809c
159 159 tag: tip
160 160 parent: 0:1160648e36ce
161 161 user: test
162 162 date: Thu Jan 01 00:00:00 1970 +0000
163 163 summary: add
164 164
165 165
166 166 find incoming on the remote side
167 167
168 168 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/local
169 169 comparing with ssh://user@dummy/local
170 170 searching for changes
171 171 changeset: 3:a28a9d1a809c
172 172 tag: tip
173 173 parent: 0:1160648e36ce
174 174 user: test
175 175 date: Thu Jan 01 00:00:00 1970 +0000
176 176 summary: add
177 177
178 178
179 179 find incoming on the remote side (using absolute path)
180 180
181 181 $ hg incoming -R ../remote -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/`pwd`"
182 182 comparing with ssh://user@dummy/$TESTTMP/local
183 183 searching for changes
184 184 changeset: 3:a28a9d1a809c
185 185 tag: tip
186 186 parent: 0:1160648e36ce
187 187 user: test
188 188 date: Thu Jan 01 00:00:00 1970 +0000
189 189 summary: add
190 190
191 191
192 192 push
193 193
194 194 $ hg push
195 195 pushing to ssh://user@dummy/remote
196 196 searching for changes
197 197 remote: adding changesets
198 198 remote: adding manifests
199 199 remote: adding file changes
200 200 remote: added 1 changesets with 1 changes to 1 files
201 201 $ cd $TESTTMP/remote
202 202
203 203 check remote tip
204 204
205 205 $ hg tip
206 206 changeset: 3:a28a9d1a809c
207 207 tag: tip
208 208 parent: 0:1160648e36ce
209 209 user: test
210 210 date: Thu Jan 01 00:00:00 1970 +0000
211 211 summary: add
212 212
213 213 $ hg verify
214 214 checking changesets
215 215 checking manifests
216 216 crosschecking files in changesets and manifests
217 217 checking files
218 218 checked 4 changesets with 3 changes to 2 files
219 219 $ hg cat -r tip foo
220 220 bleah
221 221 $ echo z > z
222 222 $ hg ci -A -m z z
223 223 created new head
224 224
225 225 test pushkeys and bookmarks
226 226
227 227 $ cd $TESTTMP/local
228 228 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote namespaces
229 229 bookmarks
230 230 namespaces
231 231 phases
232 232 $ hg book foo -r 0
233 233 $ hg out -B --config paths.default=bogus://invalid --config paths.default:pushurl=`hg paths default`
234 234 comparing with ssh://user@dummy/remote
235 235 searching for changed bookmarks
236 236 foo 1160648e36ce
237 237 $ hg push -B foo
238 238 pushing to ssh://user@dummy/remote
239 239 searching for changes
240 240 no changes found
241 241 exporting bookmark foo
242 242 [1]
243 243 $ hg debugpushkey --config ui.ssh="\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote bookmarks
244 244 foo 1160648e36cec0054048a7edc4110c6f84fde594
245 245 $ hg book -f foo
246 246 $ hg push --traceback
247 247 pushing to ssh://user@dummy/remote
248 248 searching for changes
249 249 no changes found
250 250 updating bookmark foo
251 251 [1]
252 252 $ hg book -d foo
253 253 $ hg in -B
254 254 comparing with ssh://user@dummy/remote
255 255 searching for changed bookmarks
256 256 foo a28a9d1a809c
257 257 $ hg book -f -r 0 foo
258 258 $ hg pull -B foo
259 259 pulling from ssh://user@dummy/remote
260 260 no changes found
261 261 updating bookmark foo
262 262 $ hg book -d foo
263 263 $ hg push -B foo
264 264 pushing to ssh://user@dummy/remote
265 265 searching for changes
266 266 no changes found
267 267 deleting remote bookmark foo
268 268 [1]
269 269
270 270 a bad, evil hook that prints to stdout
271 271
272 272 $ cat <<EOF > $TESTTMP/badhook
273 273 > import sys
274 274 > sys.stdout.write("KABOOM\n")
275 275 > sys.stdout.flush()
276 276 > EOF
277 277
278 278 $ cat <<EOF > $TESTTMP/badpyhook.py
279 279 > import sys
280 280 > def hook(ui, repo, hooktype, **kwargs):
281 281 > sys.stdout.write("KABOOM IN PROCESS\n")
282 282 > sys.stdout.flush()
283 283 > EOF
284 284
285 285 $ cat <<EOF >> ../remote/.hg/hgrc
286 286 > [hooks]
287 287 > changegroup.stdout = "$PYTHON" $TESTTMP/badhook
288 288 > changegroup.pystdout = python:$TESTTMP/badpyhook.py:hook
289 289 > EOF
290 290 $ echo r > r
291 291 $ hg ci -A -m z r
292 292
293 293 push should succeed even though it has an unexpected response
294 294
295 295 $ hg push
296 296 pushing to ssh://user@dummy/remote
297 297 searching for changes
298 298 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
299 299 remote: adding changesets
300 300 remote: adding manifests
301 301 remote: adding file changes
302 302 remote: added 1 changesets with 1 changes to 1 files
303 303 remote: KABOOM
304 304 remote: KABOOM IN PROCESS
305 305 $ hg -R ../remote heads
306 306 changeset: 5:1383141674ec
307 307 tag: tip
308 308 parent: 3:a28a9d1a809c
309 309 user: test
310 310 date: Thu Jan 01 00:00:00 1970 +0000
311 311 summary: z
312 312
313 313 changeset: 4:6c0482d977a3
314 314 parent: 0:1160648e36ce
315 315 user: test
316 316 date: Thu Jan 01 00:00:00 1970 +0000
317 317 summary: z
318 318
319 319
320 320 #if chg
321 321
322 322 try again with remote chg, which should succeed as well
323 323
324 324 $ hg rollback -R ../remote
325 325 repository tip rolled back to revision 4 (undo serve)
326 326
327 327 $ hg push --config ui.remotecmd=chg
328 328 pushing to ssh://user@dummy/remote
329 329 searching for changes
330 330 remote has heads on branch 'default' that are not known locally: 6c0482d977a3
331 331 remote: adding changesets
332 332 remote: adding manifests
333 333 remote: adding file changes
334 334 remote: added 1 changesets with 1 changes to 1 files (py3 !)
335 335 remote: KABOOM
336 336 remote: KABOOM IN PROCESS
337 337 remote: added 1 changesets with 1 changes to 1 files (no-py3 !)
338 338
339 339 #endif
340 340
341 341 clone bookmarks
342 342
343 343 $ hg -R ../remote bookmark test
344 344 $ hg -R ../remote bookmarks
345 345 * test 4:6c0482d977a3
346 346 $ hg clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" ssh://user@dummy/remote local-bookmarks
347 347 requesting all changes
348 348 adding changesets
349 349 adding manifests
350 350 adding file changes
351 351 added 6 changesets with 5 changes to 4 files (+1 heads)
352 352 new changesets 1160648e36ce:1383141674ec
353 353 updating to branch default
354 354 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
355 355 $ hg -R local-bookmarks bookmarks
356 356 test 4:6c0482d977a3
357 357
358 358 passwords in ssh urls are not supported
359 359 (we use a glob here because different Python versions give different
360 360 results here)
361 361
362 362 $ hg push ssh://user:erroneouspwd@dummy/remote
363 363 pushing to ssh://user:*@dummy/remote (glob)
364 364 abort: password in URL not supported
365 365 [255]
366 366
367 367 $ cd $TESTTMP
368 368
369 369 hide outer repo
370 370 $ hg init
371 371
372 372 Test remote paths with spaces (issue2983):
373 373
374 374 $ hg init --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
375 375 $ touch "$TESTTMP/a repo/test"
376 376 $ hg -R 'a repo' commit -A -m "test"
377 377 adding test
378 378 $ hg -R 'a repo' tag tag
379 379 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
380 380 73649e48688a
381 381
382 382 $ hg id --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo#noNoNO"
383 383 abort: unknown revision 'noNoNO'
384 384 [255]
385 385
386 386 Test (non-)escaping of remote paths with spaces when cloning (issue3145):
387 387
388 388 $ hg clone --ssh "\"$PYTHON\" \"$TESTDIR/dummyssh\"" "ssh://user@dummy/a repo"
389 389 destination directory: a repo
390 390 abort: destination 'a repo' is not empty
391 391 [10]
392 392
393 #if no-rhg
393 394 Make sure hg is really paranoid in serve --stdio mode. It used to be
394 395 possible to get a debugger REPL by specifying a repo named --debugger.
395 396 $ hg -R --debugger serve --stdio
396 397 abort: potentially unsafe serve --stdio invocation: ['-R', '--debugger', 'serve', '--stdio']
397 398 [255]
398 399 $ hg -R --config=ui.debugger=yes serve --stdio
399 400 abort: potentially unsafe serve --stdio invocation: ['-R', '--config=ui.debugger=yes', 'serve', '--stdio']
400 401 [255]
401 402 Abbreviations of 'serve' also don't work, to avoid shenanigans.
402 403 $ hg -R narf serv --stdio
403 404 abort: potentially unsafe serve --stdio invocation: ['-R', 'narf', 'serv', '--stdio']
404 405 [255]
406 #else
407 rhg aborts early on -R without a repository at that path
408 $ hg -R --debugger serve --stdio
409 abort: potentially unsafe serve --stdio invocation: ['-R', '--debugger', 'serve', '--stdio'] (missing-correct-output !)
410 abort: repository --debugger not found (known-bad-output !)
411 [255]
412 $ hg -R --config=ui.debugger=yes serve --stdio
413 abort: potentially unsafe serve --stdio invocation: ['-R', '--config=ui.debugger=yes', 'serve', '--stdio'] (missing-correct-output !)
414 abort: repository --config=ui.debugger=yes not found (known-bad-output !)
415 [255]
416 $ hg -R narf serv --stdio
417 abort: potentially unsafe serve --stdio invocation: ['-R', 'narf', 'serv', '--stdio'] (missing-correct-output !)
418 abort: repository narf not found (known-bad-output !)
419 [255]
420 If the repo does exist, rhg finds an unsupported command and falls back to Python
421 which still does the right thing
422 $ hg init narf
423 $ hg -R narf serv --stdio
424 abort: potentially unsafe serve --stdio invocation: ['-R', 'narf', 'serv', '--stdio']
425 [255]
426 #endif
405 427
406 428 Test hg-ssh using a helper script that will restore PYTHONPATH (which might
407 429 have been cleared by a hg.exe wrapper) and invoke hg-ssh with the right
408 430 parameters:
409 431
410 432 $ cat > ssh.sh << EOF
411 433 > userhost="\$1"
412 434 > SSH_ORIGINAL_COMMAND="\$2"
413 435 > export SSH_ORIGINAL_COMMAND
414 436 > PYTHONPATH="$PYTHONPATH"
415 437 > export PYTHONPATH
416 438 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" "$TESTTMP/a repo"
417 439 > EOF
418 440
419 441 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a repo"
420 442 73649e48688a
421 443
422 444 $ hg id --ssh "sh ssh.sh" "ssh://user@dummy/a'repo"
423 445 remote: Illegal repository "$TESTTMP/a'repo"
424 446 abort: no suitable response from remote hg
425 447 [255]
426 448
427 449 $ hg id --ssh "sh ssh.sh" --remotecmd hacking "ssh://user@dummy/a'repo"
428 450 remote: Illegal command "hacking -R 'a'\''repo' serve --stdio"
429 451 abort: no suitable response from remote hg
430 452 [255]
431 453
432 454 $ SSH_ORIGINAL_COMMAND="'hg' -R 'a'repo' serve --stdio" "$PYTHON" "$TESTDIR/../contrib/hg-ssh"
433 455 Illegal command "'hg' -R 'a'repo' serve --stdio": No closing quotation
434 456 [255]
435 457
436 458 Test hg-ssh in read-only mode:
437 459
438 460 $ cat > ssh.sh << EOF
439 461 > userhost="\$1"
440 462 > SSH_ORIGINAL_COMMAND="\$2"
441 463 > export SSH_ORIGINAL_COMMAND
442 464 > PYTHONPATH="$PYTHONPATH"
443 465 > export PYTHONPATH
444 466 > "$PYTHON" "$TESTDIR/../contrib/hg-ssh" --read-only "$TESTTMP/remote"
445 467 > EOF
446 468
447 469 $ hg clone --ssh "sh ssh.sh" "ssh://user@dummy/$TESTTMP/remote" read-only-local
448 470 requesting all changes
449 471 adding changesets
450 472 adding manifests
451 473 adding file changes
452 474 added 6 changesets with 5 changes to 4 files (+1 heads)
453 475 new changesets 1160648e36ce:1383141674ec
454 476 updating to branch default
455 477 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
456 478
457 479 $ cd read-only-local
458 480 $ echo "baz" > bar
459 481 $ hg ci -A -m "unpushable commit" bar
460 482 $ hg push --ssh "sh ../ssh.sh"
461 483 pushing to ssh://user@dummy/*/remote (glob)
462 484 searching for changes
463 485 remote: Permission denied
464 486 remote: pretxnopen.hg-ssh hook failed
465 487 abort: push failed on remote
466 488 [255]
467 489
468 490 $ cd $TESTTMP
469 491
470 492 stderr from remote commands should be printed before stdout from local code (issue4336)
471 493
472 494 $ hg clone remote stderr-ordering
473 495 updating to branch default
474 496 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
475 497 $ cd stderr-ordering
476 498 $ cat >> localwrite.py << EOF
477 499 > from mercurial import exchange, extensions
478 500 >
479 501 > def wrappedpush(orig, repo, *args, **kwargs):
480 502 > res = orig(repo, *args, **kwargs)
481 503 > repo.ui.write(b'local stdout\n')
482 504 > repo.ui.flush()
483 505 > return res
484 506 >
485 507 > def extsetup(ui):
486 508 > extensions.wrapfunction(exchange, b'push', wrappedpush)
487 509 > EOF
488 510
489 511 $ cat >> .hg/hgrc << EOF
490 512 > [paths]
491 513 > default-push = ssh://user@dummy/remote
492 514 > [ui]
493 515 > ssh = "$PYTHON" "$TESTDIR/dummyssh"
494 516 > [extensions]
495 517 > localwrite = localwrite.py
496 518 > EOF
497 519
498 520 $ echo localwrite > foo
499 521 $ hg commit -m 'testing localwrite'
500 522 $ hg push
501 523 pushing to ssh://user@dummy/remote
502 524 searching for changes
503 525 remote: adding changesets
504 526 remote: adding manifests
505 527 remote: adding file changes
506 528 remote: added 1 changesets with 1 changes to 1 files
507 529 remote: KABOOM
508 530 remote: KABOOM IN PROCESS
509 531 local stdout
510 532
511 533 debug output
512 534
513 535 $ hg pull --debug ssh://user@dummy/remote --config devel.debug.peer-request=yes
514 536 pulling from ssh://user@dummy/remote
515 537 running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re)
516 538 sending upgrade request: * proto=exp-ssh-v2-0003 (glob) (sshv2 !)
517 539 devel-peer-request: hello+between
518 540 devel-peer-request: pairs: 81 bytes
519 541 sending hello command
520 542 sending between command
521 543 remote: 444 (sshv1 !)
522 544 protocol upgraded to exp-ssh-v2-0003 (sshv2 !)
523 545 remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1,sparserevlog unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash
524 546 remote: 1 (sshv1 !)
525 547 devel-peer-request: protocaps
526 548 devel-peer-request: caps: * bytes (glob)
527 549 sending protocaps command
528 550 query 1; heads
529 551 devel-peer-request: batched-content
530 552 devel-peer-request: - heads (0 arguments)
531 553 devel-peer-request: - known (1 arguments)
532 554 devel-peer-request: batch
533 555 devel-peer-request: cmds: 141 bytes
534 556 sending batch command
535 557 searching for changes
536 558 all remote heads known locally
537 559 no changes found
538 560 devel-peer-request: getbundle
539 561 devel-peer-request: bookmarks: 1 bytes
540 562 devel-peer-request: bundlecaps: 270 bytes
541 563 devel-peer-request: cg: 1 bytes
542 564 devel-peer-request: common: 122 bytes
543 565 devel-peer-request: heads: 122 bytes
544 566 devel-peer-request: listkeys: 9 bytes
545 567 devel-peer-request: phases: 1 bytes
546 568 sending getbundle command
547 569 bundle2-input-bundle: with-transaction
548 570 bundle2-input-part: "bookmarks" supported
549 571 bundle2-input-part: total payload size 26
550 572 bundle2-input-part: "listkeys" (params: 1 mandatory) supported
551 573 bundle2-input-part: total payload size 45
552 574 bundle2-input-part: "phase-heads" supported
553 575 bundle2-input-part: total payload size 72
554 576 bundle2-input-bundle: 3 parts total
555 577 checking for updated bookmarks
556 578
557 579 $ cd $TESTTMP
558 580
559 581 $ cat dummylog
560 582 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
561 583 Got arguments 1:user@dummy 2:hg -R nonexistent serve --stdio
562 584 Got arguments 1:user@dummy 2:hg -R $TESTTMP/nonexistent serve --stdio
563 585 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
564 586 Got arguments 1:user@dummy 2:hg -R local-stream serve --stdio (no-reposimplestore !)
565 587 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
566 588 Got arguments 1:user@dummy 2:hg -R remote serve --stdio (no-reposimplestore !)
567 589 Got arguments 1:user@dummy 2:hg -R doesnotexist serve --stdio
568 590 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
569 591 Got arguments 1:user@dummy 2:hg -R local serve --stdio
570 592 Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio
571 593 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
572 594 changegroup-in-remote hook: HG_BUNDLE2=1
573 595 HG_HOOKNAME=changegroup
574 596 HG_HOOKTYPE=changegroup
575 597 HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
576 598 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60
577 599 HG_SOURCE=serve
578 600 HG_TXNID=TXN:$ID$
579 601 HG_TXNNAME=serve
580 602 HG_URL=remote:ssh:$LOCALIP
581 603
582 604 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
583 605 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
584 606 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
585 607 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
586 608 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
587 609 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
588 610 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
589 611 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
590 612 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
591 613 changegroup-in-remote hook: HG_BUNDLE2=1
592 614 HG_HOOKNAME=changegroup
593 615 HG_HOOKTYPE=changegroup
594 616 HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6
595 617 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6
596 618 HG_SOURCE=serve
597 619 HG_TXNID=TXN:$ID$
598 620 HG_TXNNAME=serve
599 621 HG_URL=remote:ssh:$LOCALIP
600 622
601 623 Got arguments 1:user@dummy 2:chg -R remote serve --stdio (chg !)
602 624 changegroup-in-remote hook: HG_BUNDLE2=1 (chg !)
603 625 HG_HOOKNAME=changegroup (chg !)
604 626 HG_HOOKTYPE=changegroup (chg !)
605 627 HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 (chg !)
606 628 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 (chg !)
607 629 HG_SOURCE=serve (chg !)
608 630 HG_TXNID=TXN:$ID$ (chg !)
609 631 HG_TXNNAME=serve (chg !)
610 632 HG_URL=remote:ssh:$LOCALIP (chg !)
611 633 (chg !)
612 634 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
613 635 Got arguments 1:user@dummy 2:hg init 'a repo'
614 636 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
615 637 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
616 638 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
617 639 Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio
618 640 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
619 641 changegroup-in-remote hook: HG_BUNDLE2=1
620 642 HG_HOOKNAME=changegroup
621 643 HG_HOOKTYPE=changegroup
622 644 HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8
623 645 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8
624 646 HG_SOURCE=serve
625 647 HG_TXNID=TXN:$ID$
626 648 HG_TXNNAME=serve
627 649 HG_URL=remote:ssh:$LOCALIP
628 650
629 651 Got arguments 1:user@dummy 2:hg -R remote serve --stdio
630 652
631 653
632 654 remote hook failure is attributed to remote
633 655
634 656 $ cat > $TESTTMP/failhook << EOF
635 657 > def hook(ui, repo, **kwargs):
636 658 > ui.write(b'hook failure!\n')
637 659 > ui.flush()
638 660 > return 1
639 661 > EOF
640 662
641 663 $ echo "pretxnchangegroup.fail = python:$TESTTMP/failhook:hook" >> remote/.hg/hgrc
642 664
643 665 $ hg -q --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" clone ssh://user@dummy/remote hookout
644 666 $ cd hookout
645 667 $ touch hookfailure
646 668 $ hg -q commit -A -m 'remote hook failure'
647 669 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" push
648 670 pushing to ssh://user@dummy/remote
649 671 searching for changes
650 672 remote: adding changesets
651 673 remote: adding manifests
652 674 remote: adding file changes
653 675 remote: hook failure!
654 676 remote: transaction abort!
655 677 remote: rollback completed
656 678 remote: pretxnchangegroup.fail hook failed
657 679 abort: push failed on remote
658 680 [255]
659 681
660 682 abort during pull is properly reported as such
661 683
662 684 $ echo morefoo >> ../remote/foo
663 685 $ hg -R ../remote commit --message "more foo to be pulled"
664 686 $ cat >> ../remote/.hg/hgrc << EOF
665 687 > [extensions]
666 688 > crash = ${TESTDIR}/crashgetbundler.py
667 689 > EOF
668 690 $ hg --config ui.ssh="\"$PYTHON\" $TESTDIR/dummyssh" pull
669 691 pulling from ssh://user@dummy/remote
670 692 searching for changes
671 693 remote: abort: this is an exercise
672 694 abort: pull failed on remote
673 695 [255]
674 696
675 697 abort with no error hint when there is a ssh problem when pulling
676 698
677 699 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\""
678 700 pulling from ssh://brokenrepository/
679 701 abort: no suitable response from remote hg
680 702 [255]
681 703
682 704 abort with configured error hint when there is a ssh problem when pulling
683 705
684 706 $ hg pull ssh://brokenrepository -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" \
685 707 > --config ui.ssherrorhint="Please see http://company/internalwiki/ssh.html"
686 708 pulling from ssh://brokenrepository/
687 709 abort: no suitable response from remote hg
688 710 (Please see http://company/internalwiki/ssh.html)
689 711 [255]
690 712
691 713 test that custom environment is passed down to ssh executable
692 714 $ cat >>dumpenv <<EOF
693 715 > #! /bin/sh
694 716 > echo \$VAR >&2
695 717 > EOF
696 718 $ chmod +x dumpenv
697 719 $ hg pull ssh://something --config ui.ssh="sh dumpenv"
698 720 pulling from ssh://something/
699 721 remote:
700 722 abort: no suitable response from remote hg
701 723 [255]
702 724 $ hg pull ssh://something --config ui.ssh="sh dumpenv" --config sshenv.VAR=17
703 725 pulling from ssh://something/
704 726 remote: 17
705 727 abort: no suitable response from remote hg
706 728 [255]
707 729
General Comments 0
You need to be logged in to leave comments. Login now