##// END OF EJS Templates
hgweb: drop references to deprecated cgitb...
Mads Kiilerich -
r51627:d5cd1fd6 stable
parent child Browse files
Show More
@@ -1,22 +1,19 b''
1 1 #!/usr/bin/env python3
2 2 #
3 3 # An example FastCGI script for use with flup, edit as necessary
4 4
5 5 # Path to repo or hgweb config to serve (see 'hg help hgweb')
6 6 config = b"/path/to/repo/or/config"
7 7
8 8 # Uncomment and adjust if Mercurial is not installed system-wide
9 9 # (consult "installed modules" path from 'hg debuginstall'):
10 10 # import sys; sys.path.insert(0, "/path/to/python/lib")
11 11
12 # Uncomment to send python tracebacks to the browser if an error occurs:
13 # import cgitb; cgitb.enable()
14
15 12 from mercurial import demandimport
16 13
17 14 demandimport.enable()
18 15 from mercurial.hgweb import hgweb
19 16 from flup.server.fcgi import WSGIServer
20 17
21 18 application = hgweb(config)
22 19 WSGIServer(application).run()
@@ -1,18 +1,15 b''
1 1 # An example WSGI for use with mod_wsgi, edit as necessary
2 2 # See https://mercurial-scm.org/wiki/modwsgi for more information
3 3
4 4 # Path to repo or hgweb config to serve (see 'hg help hgweb')
5 5 config = b"/path/to/repo/or/config"
6 6
7 7 # Uncomment and adjust if Mercurial is not installed system-wide
8 8 # (consult "installed modules" path from 'hg debuginstall'):
9 9 #import sys; sys.path.insert(0, "/path/to/python/lib")
10 10
11 # Uncomment to send python tracebacks to the browser if an error occurs:
12 #import cgitb; cgitb.enable()
13
14 11 # enable demandloading to reduce startup time
15 12 from mercurial import demandimport; demandimport.enable()
16 13
17 14 from mercurial.hgweb import hgweb
18 15 application = hgweb(config)
@@ -1,22 +1,19 b''
1 1 #!/usr/bin/env python3
2 2 #
3 3 # An example hgweb CGI script, edit as necessary
4 4 # See also https://mercurial-scm.org/wiki/PublishingRepositories
5 5
6 6 # Path to repo or hgweb config to serve (see 'hg help hgweb')
7 7 config = b"/path/to/repo/or/config"
8 8
9 9 # Uncomment and adjust if Mercurial is not installed system-wide
10 10 # (consult "installed modules" path from 'hg debuginstall'):
11 11 # import sys; sys.path.insert(0, "/path/to/python/lib")
12 12
13 # Uncomment to send python tracebacks to the browser if an error occurs:
14 # import cgitb; cgitb.enable()
15
16 13 from mercurial import demandimport
17 14
18 15 demandimport.enable()
19 16 from mercurial.hgweb import hgweb, wsgicgi
20 17
21 18 application = hgweb(config)
22 19 wsgicgi.launch(application)
@@ -1,39 +1,37 b''
1 1 #require no-msys # MSYS will translate web paths as if they were file paths
2 2
3 3 This is a test of the wire protocol over CGI-based hgweb.
4 4 initialize repository
5 5
6 6 $ hg init test
7 7 $ cd test
8 8 $ echo a > a
9 9 $ hg ci -Ama
10 10 adding a
11 11 $ cd ..
12 12 $ cat >hgweb.cgi <<HGWEB
13 13 > #
14 14 > # An example CGI script to use hgweb, edit as necessary
15 > import cgitb
16 > cgitb.enable()
17 15 > from mercurial import demandimport; demandimport.enable()
18 16 > from mercurial.hgweb import hgweb
19 17 > from mercurial.hgweb import wsgicgi
20 18 > application = hgweb(b"test", b"Empty test repository")
21 19 > wsgicgi.launch(application)
22 20 > HGWEB
23 21 $ chmod 755 hgweb.cgi
24 22
25 23 try hgweb request
26 24
27 25 $ . "$TESTDIR/cgienv"
28 26 $ QUERY_STRING="cmd=changegroup&roots=0000000000000000000000000000000000000000"; export QUERY_STRING
29 27 $ "$PYTHON" hgweb.cgi >page1 2>&1
30 28 $ "$PYTHON" "$TESTDIR/md5sum.py" page1
31 29 1f424bb22ec05c3c6bc866b6e67efe43 page1
32 30
33 31 make sure headers are sent even when there is no body
34 32
35 33 $ QUERY_STRING="cmd=listkeys&namespace=nosuchnamespace" "$PYTHON" hgweb.cgi
36 34 Status: 200 Script output follows\r (esc)
37 35 Content-Type: application/mercurial-0.1\r (esc)
38 36 Content-Length: 0\r (esc)
39 37 \r (esc)
@@ -1,1622 +1,1620 b''
1 1 $ checkundo()
2 2 > {
3 3 > if [ -f .hg/store/undo ]; then
4 4 > echo ".hg/store/undo still exists after $1"
5 5 > fi
6 6 > }
7 7
8 8 $ cat <<EOF >> $HGRCPATH
9 9 > [extensions]
10 10 > mq =
11 11 > [mq]
12 12 > plain = true
13 13 > EOF
14 14
15 15
16 16 help
17 17
18 18 $ hg help mq
19 19 mq extension - manage a stack of patches
20 20
21 21 This extension lets you work with a stack of patches in a Mercurial
22 22 repository. It manages two stacks of patches - all known patches, and applied
23 23 patches (subset of known patches).
24 24
25 25 Known patches are represented as patch files in the .hg/patches directory.
26 26 Applied patches are both patch files and changesets.
27 27
28 28 Common tasks (use 'hg help COMMAND' for more details):
29 29
30 30 create new patch qnew
31 31 import existing patch qimport
32 32
33 33 print patch series qseries
34 34 print applied patches qapplied
35 35
36 36 add known patch to applied stack qpush
37 37 remove patch from applied stack qpop
38 38 refresh contents of top applied patch qrefresh
39 39
40 40 By default, mq will automatically use git patches when required to avoid
41 41 losing file mode changes, copy records, binary files or empty files creations
42 42 or deletions. This behavior can be configured with:
43 43
44 44 [mq]
45 45 git = auto/keep/yes/no
46 46
47 47 If set to 'keep', mq will obey the [diff] section configuration while
48 48 preserving existing git patches upon qrefresh. If set to 'yes' or 'no', mq
49 49 will override the [diff] section and always generate git or regular patches,
50 50 possibly losing data in the second case.
51 51
52 52 It may be desirable for mq changesets to be kept in the secret phase (see 'hg
53 53 help phases'), which can be enabled with the following setting:
54 54
55 55 [mq]
56 56 secret = True
57 57
58 58 You will by default be managing a patch queue named "patches". You can create
59 59 other, independent patch queues with the 'hg qqueue' command.
60 60
61 61 If the working directory contains uncommitted files, qpush, qpop and qgoto
62 62 abort immediately. If -f/--force is used, the changes are discarded. Setting:
63 63
64 64 [mq]
65 65 keepchanges = True
66 66
67 67 make them behave as if --keep-changes were passed, and non-conflicting local
68 68 changes will be tolerated and preserved. If incompatible options such as
69 69 -f/--force or --exact are passed, this setting is ignored.
70 70
71 71 This extension used to provide a strip command. This command now lives in the
72 72 strip extension.
73 73
74 74 list of commands:
75 75
76 76 Repository creation:
77 77
78 78 qclone clone main and patch repository at same time
79 79
80 80 Change creation:
81 81
82 82 qnew create a new patch
83 83 qrefresh update the current patch
84 84
85 85 Change manipulation:
86 86
87 87 qfold fold the named patches into the current patch
88 88
89 89 Change organization:
90 90
91 91 qapplied print the patches already applied
92 92 qdelete remove patches from queue
93 93 qfinish move applied patches into repository history
94 94 qgoto push or pop patches until named patch is at top of stack
95 95 qguard set or print guards for a patch
96 96 qheader print the header of the topmost or specified patch
97 97 qnext print the name of the next pushable patch
98 98 qpop pop the current patch off the stack
99 99 qprev print the name of the preceding applied patch
100 100 qpush push the next patch onto the stack
101 101 qqueue manage multiple patch queues
102 102 qrename rename a patch
103 103 qselect set or print guarded patches to push
104 104 qseries print the entire series file
105 105 qtop print the name of the current patch
106 106 qunapplied print the patches not yet applied
107 107
108 108 File content management:
109 109
110 110 qdiff diff of the current patch and subsequent modifications
111 111
112 112 Change import/export:
113 113
114 114 qimport import a patch or existing changeset
115 115
116 116 (use 'hg help -v mq' to show built-in aliases and global options)
117 117
118 118 $ hg init a
119 119 $ cd a
120 120 $ echo a > a
121 121 $ hg ci -Ama
122 122 adding a
123 123
124 124 $ hg clone . ../k
125 125 updating to branch default
126 126 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
127 127
128 128 $ mkdir b
129 129 $ echo z > b/z
130 130 $ hg ci -Ama
131 131 adding b/z
132 132
133 133
134 134 qinit
135 135
136 136 $ hg qinit
137 137
138 138 $ cd ..
139 139 $ hg init b
140 140
141 141
142 142 -R qinit
143 143
144 144 $ hg -R b qinit
145 145
146 146 $ hg init c
147 147
148 148
149 149 qinit -c
150 150
151 151 $ hg --cwd c qinit -c
152 152 $ hg -R c/.hg/patches st
153 153 A .hgignore
154 154 A series
155 155
156 156
157 157 qinit; qinit -c
158 158
159 159 $ hg init d
160 160 $ cd d
161 161 $ hg qinit
162 162 $ hg qinit -c
163 163
164 164 qinit -c should create both files if they don't exist
165 165
166 166 $ cat .hg/patches/.hgignore
167 167 ^\.hg
168 168 ^\.mq
169 169 syntax: glob
170 170 status
171 171 guards
172 172 $ cat .hg/patches/series
173 173 $ hg qinit -c
174 174 abort: repository $TESTTMP/d/.hg/patches already exists
175 175 [255]
176 176 $ cd ..
177 177
178 178 $ echo '% qinit; <stuff>; qinit -c'
179 179 % qinit; <stuff>; qinit -c
180 180 $ hg init e
181 181 $ cd e
182 182 $ hg qnew A
183 183 $ checkundo qnew
184 184 $ echo foo > foo
185 185 $ hg phase -r qbase
186 186 0: draft
187 187 $ hg add foo
188 188 $ hg qrefresh
189 189 $ hg phase -r qbase
190 190 0: draft
191 191 $ hg qnew B
192 192 $ echo >> foo
193 193 $ hg qrefresh
194 194 $ echo status >> .hg/patches/.hgignore
195 195 $ echo bleh >> .hg/patches/.hgignore
196 196 $ hg qinit -c
197 197 adding .hg/patches/A
198 198 adding .hg/patches/B
199 199 $ hg -R .hg/patches status
200 200 A .hgignore
201 201 A A
202 202 A B
203 203 A series
204 204
205 205 qinit -c shouldn't touch these files if they already exist
206 206
207 207 $ cat .hg/patches/.hgignore
208 208 status
209 209 bleh
210 210 $ cat .hg/patches/series
211 211 A
212 212 B
213 213
214 214 add an untracked file
215 215
216 216 $ echo >> .hg/patches/flaf
217 217
218 218 status --mq with color (issue2096)
219 219
220 220 $ hg status --mq --config extensions.color= --config color.mode=ansi --color=always
221 221 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1m.hgignore\x1b[0m (esc)
222 222 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mA\x1b[0m (esc)
223 223 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mB\x1b[0m (esc)
224 224 \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mseries\x1b[0m (esc)
225 225 \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4mflaf\x1b[0m (esc)
226 226
227 227 try the --mq option on a command provided by an extension
228 228
229 229 $ hg purge --mq --verbose --config extensions.purge=
230 230 removing file flaf
231 231
232 232 $ cd ..
233 233
234 234 #if no-outer-repo
235 235
236 236 init --mq without repo
237 237
238 238 $ mkdir f
239 239 $ cd f
240 240 $ hg init --mq
241 241 abort: there is no Mercurial repository here (.hg not found)
242 242 [255]
243 243 $ cd ..
244 244
245 245 #endif
246 246
247 247 init --mq with repo path
248 248
249 249 $ hg init g
250 250 $ hg init --mq g
251 251 $ test -d g/.hg/patches/.hg
252 252
253 253 init --mq with nonexistent directory
254 254
255 255 $ hg init --mq nonexistentdir
256 256 abort: repository nonexistentdir not found
257 257 [255]
258 258
259 259
260 260 init --mq with bundle (non "local")
261 261
262 262 $ hg -R a bundle --all a.bundle >/dev/null
263 263 $ hg init --mq a.bundle
264 264 abort: only a local queue repository may be initialized
265 265 [255]
266 266
267 267 $ cd a
268 268
269 269 $ hg qnew -m 'foo bar' test.patch
270 270
271 271 $ echo '# comment' > .hg/patches/series.tmp
272 272 $ echo >> .hg/patches/series.tmp # empty line
273 273 $ cat .hg/patches/series >> .hg/patches/series.tmp
274 274 $ mv .hg/patches/series.tmp .hg/patches/series
275 275
276 276
277 277 qrefresh
278 278
279 279 $ echo a >> a
280 280 $ hg qrefresh
281 281 $ cat .hg/patches/test.patch
282 282 foo bar
283 283
284 284 diff -r [a-f0-9]* a (re)
285 285 --- a/a\t(?P<date>.*) (re)
286 286 \+\+\+ b/a\t(?P<date2>.*) (re)
287 287 @@ -1,1 +1,2 @@
288 288 a
289 289 +a
290 290
291 291 empty qrefresh
292 292
293 293 $ hg qrefresh -X a
294 294
295 295 revision:
296 296
297 297 $ hg diff -r -2 -r -1
298 298
299 299 patch:
300 300
301 301 $ cat .hg/patches/test.patch
302 302 foo bar
303 303
304 304
305 305 working dir diff:
306 306
307 307 $ hg diff --nodates -q
308 308 diff -r dde259bd5934 a
309 309 --- a/a
310 310 +++ b/a
311 311 @@ -1,1 +1,2 @@
312 312 a
313 313 +a
314 314
315 315 restore things
316 316
317 317 $ hg qrefresh
318 318 $ checkundo qrefresh
319 319
320 320
321 321 qpop
322 322
323 323 $ hg qpop
324 324 popping test.patch
325 325 patch queue now empty
326 326 $ checkundo qpop
327 327
328 328
329 329 qpush with dump of tag cache
330 330 Dump the tag cache to ensure that it has exactly one head after qpush.
331 331
332 332 $ rm -f .hg/cache/tags2-visible
333 333 $ hg tags > /dev/null
334 334
335 335 .hg/cache/tags2-visible (pre qpush):
336 336
337 337 $ cat .hg/cache/tags2-visible
338 338 1 [\da-f]{40} (re)
339 339 $ hg qpush
340 340 applying test.patch
341 341 now at: test.patch
342 342 $ hg phase -r qbase
343 343 2: draft
344 344 $ hg tags > /dev/null
345 345
346 346 .hg/cache/tags2-visible (post qpush):
347 347
348 348 $ cat .hg/cache/tags2-visible
349 349 2 [\da-f]{40} (re)
350 350 $ checkundo qpush
351 351 $ cd ..
352 352
353 353
354 354 pop/push outside repo
355 355 $ hg -R a qpop
356 356 popping test.patch
357 357 patch queue now empty
358 358 $ hg -R a qpush
359 359 applying test.patch
360 360 now at: test.patch
361 361
362 362 $ cd a
363 363 $ hg qnew test2.patch
364 364
365 365 qrefresh in subdir
366 366
367 367 $ cd b
368 368 $ echo a > a
369 369 $ hg add a
370 370 $ hg qrefresh
371 371
372 372 pop/push -a in subdir
373 373
374 374 $ hg qpop -a
375 375 popping test2.patch
376 376 popping test.patch
377 377 patch queue now empty
378 378 $ hg --traceback qpush -a
379 379 applying test.patch
380 380 applying test2.patch
381 381 now at: test2.patch
382 382
383 383
384 384 setting columns & formatted tests truncating (issue1912)
385 385
386 386 $ COLUMNS=4 hg qseries --config ui.formatted=true --color=no
387 387 test.patch
388 388 test2.patch
389 389 $ COLUMNS=20 hg qseries --config ui.formatted=true -vs --color=no
390 390 0 A test.patch: f...
391 391 1 A test2.patch:
392 392 $ hg qpop
393 393 popping test2.patch
394 394 now at: test.patch
395 395 $ hg qseries -vs
396 396 0 A test.patch: foo bar
397 397 1 U test2.patch:
398 398 $ hg sum | grep mq
399 399 mq: 1 applied, 1 unapplied
400 400 $ hg qpush
401 401 applying test2.patch
402 402 now at: test2.patch
403 403 $ hg sum | grep mq
404 404 mq: 2 applied
405 405 $ hg qapplied
406 406 test.patch
407 407 test2.patch
408 408 $ hg qtop
409 409 test2.patch
410 410
411 411
412 412 prev
413 413
414 414 $ hg qapp -1
415 415 test.patch
416 416
417 417 next
418 418
419 419 $ hg qunapp -1
420 420 all patches applied
421 421 [1]
422 422
423 423 $ hg qpop
424 424 popping test2.patch
425 425 now at: test.patch
426 426
427 427 commit should fail
428 428
429 429 $ hg commit
430 430 abort: cannot commit over an applied mq patch
431 431 [255]
432 432
433 433 push should fail if draft
434 434
435 435 $ hg push ../../k
436 436 pushing to ../../k
437 437 abort: source has mq patches applied
438 438 [255]
439 439
440 440
441 441 import should fail
442 442
443 443 $ hg st .
444 444 $ echo foo >> ../a
445 445 $ hg diff > ../../import.diff
446 446 $ hg revert --no-backup ../a
447 447 $ hg import ../../import.diff
448 448 abort: cannot import over an applied patch
449 449 [255]
450 450 $ hg st
451 451
452 452 import --no-commit should succeed
453 453
454 454 $ hg import --no-commit ../../import.diff
455 455 applying ../../import.diff
456 456 $ hg st
457 457 M a
458 458 $ hg revert --no-backup ../a
459 459
460 460
461 461 qunapplied
462 462
463 463 $ hg qunapplied
464 464 test2.patch
465 465
466 466
467 467 qpush/qpop with index
468 468
469 469 $ hg qnew test1b.patch
470 470 $ echo 1b > 1b
471 471 $ hg add 1b
472 472 $ hg qrefresh
473 473 $ hg qpush 2
474 474 applying test2.patch
475 475 now at: test2.patch
476 476 $ hg qpop 0
477 477 popping test2.patch
478 478 popping test1b.patch
479 479 now at: test.patch
480 480 $ hg qpush test.patch+1
481 481 applying test1b.patch
482 482 now at: test1b.patch
483 483 $ hg qpush test.patch+2
484 484 applying test2.patch
485 485 now at: test2.patch
486 486 $ hg qpop test2.patch-1
487 487 popping test2.patch
488 488 now at: test1b.patch
489 489 $ hg qpop test2.patch-2
490 490 popping test1b.patch
491 491 now at: test.patch
492 492 $ hg qpush test1b.patch+1
493 493 applying test1b.patch
494 494 applying test2.patch
495 495 now at: test2.patch
496 496
497 497
498 498 qpush --move
499 499
500 500 $ hg qpop -a
501 501 popping test2.patch
502 502 popping test1b.patch
503 503 popping test.patch
504 504 patch queue now empty
505 505 $ hg qguard test1b.patch -- -negguard
506 506 $ hg qguard test2.patch -- +posguard
507 507 $ hg qpush --move test2.patch # can't move guarded patch
508 508 cannot push 'test2.patch' - guarded by '+posguard'
509 509 [1]
510 510 $ hg qselect posguard
511 511 number of unguarded, unapplied patches has changed from 2 to 3
512 512 $ hg qpush --move test2.patch # move to front
513 513 applying test2.patch
514 514 now at: test2.patch
515 515 $ hg qpush --move test1b.patch # negative guard unselected
516 516 applying test1b.patch
517 517 now at: test1b.patch
518 518 $ hg qpush --move test.patch # noop move
519 519 applying test.patch
520 520 now at: test.patch
521 521 $ hg qseries -v
522 522 0 A test2.patch
523 523 1 A test1b.patch
524 524 2 A test.patch
525 525 $ hg qpop -a
526 526 popping test.patch
527 527 popping test1b.patch
528 528 popping test2.patch
529 529 patch queue now empty
530 530
531 531 cleaning up
532 532
533 533 $ hg qselect --none
534 534 guards deactivated
535 535 number of unguarded, unapplied patches has changed from 3 to 2
536 536 $ hg qguard --none test1b.patch
537 537 $ hg qguard --none test2.patch
538 538 $ hg qpush --move test.patch
539 539 applying test.patch
540 540 now at: test.patch
541 541 $ hg qpush --move test1b.patch
542 542 applying test1b.patch
543 543 now at: test1b.patch
544 544 $ hg qpush --move bogus # nonexistent patch
545 545 abort: patch bogus not in series
546 546 [255]
547 547 $ hg qpush --move # no patch
548 548 abort: please specify the patch to move
549 549 [255]
550 550 $ hg qpush --move test.patch # already applied
551 551 abort: cannot push to a previous patch: test.patch
552 552 [255]
553 553 $ sed '2i\
554 554 > # make qtip index different in series and fullseries
555 555 > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
556 556 $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
557 557 $ cat `hg root`/.hg/patches/series
558 558 # comment
559 559 # make qtip index different in series and fullseries
560 560
561 561 test.patch
562 562 test1b.patch
563 563 test2.patch
564 564 $ hg qpush --move test2.patch
565 565 applying test2.patch
566 566 now at: test2.patch
567 567
568 568
569 569 series after move
570 570
571 571 $ cat `hg root`/.hg/patches/series
572 572 # comment
573 573 # make qtip index different in series and fullseries
574 574
575 575 test.patch
576 576 test1b.patch
577 577 test2.patch
578 578
579 579
580 580 pop, qapplied, qunapplied
581 581
582 582 $ hg qseries -v
583 583 0 A test.patch
584 584 1 A test1b.patch
585 585 2 A test2.patch
586 586
587 587 qapplied -1 test.patch
588 588
589 589 $ hg qapplied -1 test.patch
590 590 only one patch applied
591 591 [1]
592 592
593 593 qapplied -1 test1b.patch
594 594
595 595 $ hg qapplied -1 test1b.patch
596 596 test.patch
597 597
598 598 qapplied -1 test2.patch
599 599
600 600 $ hg qapplied -1 test2.patch
601 601 test1b.patch
602 602
603 603 qapplied -1
604 604
605 605 $ hg qapplied -1
606 606 test1b.patch
607 607
608 608 qapplied
609 609
610 610 $ hg qapplied
611 611 test.patch
612 612 test1b.patch
613 613 test2.patch
614 614
615 615 qapplied test1b.patch
616 616
617 617 $ hg qapplied test1b.patch
618 618 test.patch
619 619 test1b.patch
620 620
621 621 qunapplied -1
622 622
623 623 $ hg qunapplied -1
624 624 all patches applied
625 625 [1]
626 626
627 627 qunapplied
628 628
629 629 $ hg qunapplied
630 630
631 631 popping
632 632
633 633 $ hg qpop
634 634 popping test2.patch
635 635 now at: test1b.patch
636 636
637 637 qunapplied -1
638 638
639 639 $ hg qunapplied -1
640 640 test2.patch
641 641
642 642 qunapplied
643 643
644 644 $ hg qunapplied
645 645 test2.patch
646 646
647 647 qunapplied test2.patch
648 648
649 649 $ hg qunapplied test2.patch
650 650
651 651 qunapplied -1 test2.patch
652 652
653 653 $ hg qunapplied -1 test2.patch
654 654 all patches applied
655 655 [1]
656 656
657 657 popping -a
658 658
659 659 $ hg qpop -a
660 660 popping test1b.patch
661 661 popping test.patch
662 662 patch queue now empty
663 663
664 664 qapplied
665 665
666 666 $ hg qapplied
667 667
668 668 qapplied -1
669 669
670 670 $ hg qapplied -1
671 671 no patches applied
672 672 [1]
673 673 $ hg qpush
674 674 applying test.patch
675 675 now at: test.patch
676 676
677 677
678 678 push should succeed
679 679
680 680 $ hg qpop -a
681 681 popping test.patch
682 682 patch queue now empty
683 683 $ hg push ../../k
684 684 pushing to ../../k
685 685 searching for changes
686 686 adding changesets
687 687 adding manifests
688 688 adding file changes
689 689 added 1 changesets with 1 changes to 1 files
690 690
691 691
692 692 we want to start with some patches applied
693 693
694 694 $ hg qpush -a
695 695 applying test.patch
696 696 applying test1b.patch
697 697 applying test2.patch
698 698 now at: test2.patch
699 699
700 700 % pops all patches and succeeds
701 701
702 702 $ hg qpop -a
703 703 popping test2.patch
704 704 popping test1b.patch
705 705 popping test.patch
706 706 patch queue now empty
707 707
708 708 % does nothing and succeeds
709 709
710 710 $ hg qpop -a
711 711 no patches applied
712 712
713 713 % fails - nothing else to pop
714 714
715 715 $ hg qpop
716 716 no patches applied
717 717 [1]
718 718
719 719 % pushes a patch and succeeds
720 720
721 721 $ hg qpush
722 722 applying test.patch
723 723 now at: test.patch
724 724
725 725 % pops a patch and succeeds
726 726
727 727 $ hg qpop
728 728 popping test.patch
729 729 patch queue now empty
730 730
731 731 % pushes up to test1b.patch and succeeds
732 732
733 733 $ hg qpush test1b.patch
734 734 applying test.patch
735 735 applying test1b.patch
736 736 now at: test1b.patch
737 737
738 738 % does nothing and succeeds
739 739
740 740 $ hg qpush test1b.patch
741 741 qpush: test1b.patch is already at the top
742 742
743 743 % does nothing and succeeds
744 744
745 745 $ hg qpop test1b.patch
746 746 qpop: test1b.patch is already at the top
747 747
748 748 % fails - can't push to this patch
749 749
750 750 $ hg qpush test.patch
751 751 abort: cannot push to a previous patch: test.patch
752 752 [255]
753 753
754 754 % fails - can't pop to this patch
755 755
756 756 $ hg qpop test2.patch
757 757 abort: patch test2.patch is not applied
758 758 [255]
759 759
760 760 % pops up to test.patch and succeeds
761 761
762 762 $ hg qpop test.patch
763 763 popping test1b.patch
764 764 now at: test.patch
765 765
766 766 % pushes all patches and succeeds
767 767
768 768 $ hg qpush -a
769 769 applying test1b.patch
770 770 applying test2.patch
771 771 now at: test2.patch
772 772
773 773 % does nothing and succeeds
774 774
775 775 $ hg qpush -a
776 776 all patches are currently applied
777 777
778 778 % fails - nothing else to push
779 779
780 780 $ hg qpush
781 781 patch series already fully applied
782 782 [1]
783 783
784 784 % does nothing and succeeds
785 785
786 786 $ hg qpush test2.patch
787 787 qpush: test2.patch is already at the top
788 788
789 789 strip
790 790
791 791 $ cd ../../b
792 792 $ echo x>x
793 793 $ hg ci -Ama
794 794 adding x
795 795 $ hg strip tip
796 796 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
797 797 saved backup bundle to $TESTTMP/b/.hg/strip-backup/*-backup.hg (glob)
798 798 $ hg unbundle .hg/strip-backup/*
799 799 adding changesets
800 800 adding manifests
801 801 adding file changes
802 802 added 1 changesets with 1 changes to 1 files
803 803 new changesets 770eb8fce608 (1 drafts)
804 804 (run 'hg update' to get a working copy)
805 805
806 806
807 807 strip with local changes, should complain
808 808
809 809 $ hg up
810 810 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
811 811 $ echo y>y
812 812 $ hg add y
813 813 $ hg strip tip
814 814 abort: uncommitted changes
815 815 [20]
816 816
817 817 --force strip with local changes
818 818
819 819 $ hg strip -f tip
820 820 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
821 821 saved backup bundle to $TESTTMP/b/.hg/strip-backup/770eb8fce608-0ddcae0f-backup.hg
822 822 $ cd ..
823 823
824 824
825 825 cd b; hg qrefresh
826 826
827 827 $ hg init refresh
828 828 $ cd refresh
829 829 $ echo a > a
830 830 $ hg ci -Ama
831 831 adding a
832 832 $ hg qnew -mfoo foo
833 833 $ echo a >> a
834 834 $ hg qrefresh
835 835 $ mkdir b
836 836 $ cd b
837 837 $ echo f > f
838 838 $ hg add f
839 839 $ hg qrefresh
840 840 $ cat ../.hg/patches/foo
841 841 foo
842 842
843 843 diff -r cb9a9f314b8b a
844 844 --- a/a\t(?P<date>.*) (re)
845 845 \+\+\+ b/a\t(?P<date>.*) (re)
846 846 @@ -1,1 +1,2 @@
847 847 a
848 848 +a
849 849 diff -r cb9a9f314b8b b/f
850 850 --- /dev/null\t(?P<date>.*) (re)
851 851 \+\+\+ b/b/f\t(?P<date>.*) (re)
852 852 @@ -0,0 +1,1 @@
853 853 +f
854 854
855 855 hg qrefresh .
856 856
857 857 $ hg qrefresh .
858 858 $ cat ../.hg/patches/foo
859 859 foo
860 860
861 861 diff -r cb9a9f314b8b b/f
862 862 --- /dev/null\t(?P<date>.*) (re)
863 863 \+\+\+ b/b/f\t(?P<date>.*) (re)
864 864 @@ -0,0 +1,1 @@
865 865 +f
866 866 $ hg status
867 867 M a
868 868
869 869
870 870 qpush failure
871 871
872 872 $ cd ..
873 873 $ hg qrefresh
874 874 $ hg qnew -mbar bar
875 875 $ echo foo > foo
876 876 $ echo bar > bar
877 877 $ hg add foo bar
878 878 $ hg qrefresh
879 879 $ hg qpop -a
880 880 popping bar
881 881 popping foo
882 882 patch queue now empty
883 883 $ echo bar > foo
884 884 $ hg qpush -a
885 885 applying foo
886 886 applying bar
887 887 file foo already exists
888 888 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
889 889 patch failed, unable to continue (try -v)
890 890 patch failed, rejects left in working directory
891 891 errors during apply, please fix and qrefresh bar
892 892 [2]
893 893 $ hg st
894 894 ? foo
895 895 ? foo.rej
896 896
897 897
898 898 mq tags
899 899
900 900 $ hg log --template '{rev} {tags}\n' -r qparent:qtip
901 901 0 qparent
902 902 1 foo qbase
903 903 2 bar qtip tip
904 904
905 905 mq revset
906 906
907 907 $ hg log -r 'mq()' --template '{rev}\n'
908 908 1
909 909 2
910 910 $ hg help revisions.mq
911 911 "mq()"
912 912 Changesets managed by MQ.
913 913
914 914
915 915 bad node in status
916 916
917 917 $ hg qpop
918 918 popping bar
919 919 now at: foo
920 920 $ hg strip -qn tip
921 921 $ hg tip
922 922 changeset: 0:cb9a9f314b8b
923 923 tag: tip
924 924 user: test
925 925 date: Thu Jan 01 00:00:00 1970 +0000
926 926 summary: a
927 927
928 928 $ hg branches
929 929 default 0:cb9a9f314b8b
930 930 $ hg qpop
931 931 no patches applied
932 932 [1]
933 933
934 934 $ cd ..
935 935
936 936
937 937 git patches
938 938
939 939 $ cat >>$HGRCPATH <<EOF
940 940 > [diff]
941 941 > git = True
942 942 > EOF
943 943 $ hg init git
944 944 $ cd git
945 945 $ hg qinit
946 946
947 947 $ hg qnew -m'new file' new
948 948 $ echo foo > new
949 949 #if execbit
950 950 $ chmod +x new
951 951 #endif
952 952 $ hg add new
953 953 $ hg qrefresh
954 954
955 955 $ cat .hg/patches/new
956 956 new file
957 957
958 958 diff --git a/new b/new
959 959 new file mode 100755 (execbit !)
960 960 new file mode 100644 (no-execbit !)
961 961 --- /dev/null
962 962 +++ b/new
963 963 @@ -0,0 +1,1 @@
964 964 +foo
965 965
966 966 $ hg qnew -m'copy file' copy
967 967 $ hg cp new copy
968 968 $ hg qrefresh
969 969 $ cat .hg/patches/copy
970 970 copy file
971 971
972 972 diff --git a/new b/copy
973 973 copy from new
974 974 copy to copy
975 975
976 976 $ hg qpop
977 977 popping copy
978 978 now at: new
979 979 $ hg qpush
980 980 applying copy
981 981 now at: copy
982 982 $ hg qdiff
983 983 diff --git a/new b/copy
984 984 copy from new
985 985 copy to copy
986 986 $ cat >>$HGRCPATH <<EOF
987 987 > [diff]
988 988 > git = False
989 989 > EOF
990 990 $ hg qdiff --git
991 991 diff --git a/new b/copy
992 992 copy from new
993 993 copy to copy
994 994 $ cd ..
995 995
996 996 empty lines in status
997 997
998 998 $ hg init emptystatus
999 999 $ cd emptystatus
1000 1000 $ hg qinit
1001 1001 $ printf '\n\n' > .hg/patches/status
1002 1002 $ hg qser
1003 1003 $ cd ..
1004 1004
1005 1005 bad line in status (without ":")
1006 1006
1007 1007 $ hg init badstatus
1008 1008 $ cd badstatus
1009 1009 $ hg qinit
1010 1010 $ printf 'babar has no colon in this line\n' > .hg/patches/status
1011 1011 $ hg qser
1012 1012 malformated mq status line: ['babar has no colon in this line']
1013 1013 $ cd ..
1014 1014
1015 1015
1016 1016 test file addition in slow path
1017 1017
1018 1018 $ hg init slow
1019 1019 $ cd slow
1020 1020 $ hg qinit
1021 1021 $ echo foo > foo
1022 1022 $ hg add foo
1023 1023 $ hg ci -m 'add foo'
1024 1024 $ hg qnew bar
1025 1025 $ echo bar > bar
1026 1026 $ hg add bar
1027 1027 $ hg mv foo baz
1028 1028 $ hg qrefresh --git
1029 1029 $ hg up -C 0
1030 1030 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1031 1031 $ echo >> foo
1032 1032 $ hg ci -m 'change foo'
1033 1033 created new head
1034 1034 $ hg up -C 1
1035 1035 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1036 1036 $ hg qrefresh --git
1037 1037 $ cat .hg/patches/bar
1038 1038 diff --git a/bar b/bar
1039 1039 new file mode 100644
1040 1040 --- /dev/null
1041 1041 +++ b/bar
1042 1042 @@ -0,0 +1,1 @@
1043 1043 +bar
1044 1044 diff --git a/foo b/baz
1045 1045 rename from foo
1046 1046 rename to baz
1047 1047 $ hg log -v --template '{rev} {file_copies}\n' -r .
1048 1048 2 baz (foo)
1049 1049 $ hg qrefresh --git
1050 1050 $ cat .hg/patches/bar
1051 1051 diff --git a/bar b/bar
1052 1052 new file mode 100644
1053 1053 --- /dev/null
1054 1054 +++ b/bar
1055 1055 @@ -0,0 +1,1 @@
1056 1056 +bar
1057 1057 diff --git a/foo b/baz
1058 1058 rename from foo
1059 1059 rename to baz
1060 1060 $ hg log -v --template '{rev} {file_copies}\n' -r .
1061 1061 2 baz (foo)
1062 1062 $ hg qrefresh
1063 1063 $ grep 'diff --git' .hg/patches/bar
1064 1064 diff --git a/bar b/bar
1065 1065 diff --git a/foo b/baz
1066 1066
1067 1067
1068 1068 test file move chains in the slow path
1069 1069
1070 1070 $ hg up -C 1
1071 1071 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1072 1072 $ echo >> foo
1073 1073 $ hg ci -m 'change foo again'
1074 1074 $ hg up -C 2
1075 1075 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1076 1076 $ hg mv bar quux
1077 1077 $ hg mv baz bleh
1078 1078 $ hg qrefresh --git
1079 1079 $ cat .hg/patches/bar
1080 1080 diff --git a/foo b/bleh
1081 1081 rename from foo
1082 1082 rename to bleh
1083 1083 diff --git a/quux b/quux
1084 1084 new file mode 100644
1085 1085 --- /dev/null
1086 1086 +++ b/quux
1087 1087 @@ -0,0 +1,1 @@
1088 1088 +bar
1089 1089 $ hg log -v --template '{rev} {file_copies}\n' -r .
1090 1090 3 bleh (foo)
1091 1091 $ hg mv quux fred
1092 1092 $ hg mv bleh barney
1093 1093 $ hg qrefresh --git
1094 1094 $ cat .hg/patches/bar
1095 1095 diff --git a/foo b/barney
1096 1096 rename from foo
1097 1097 rename to barney
1098 1098 diff --git a/fred b/fred
1099 1099 new file mode 100644
1100 1100 --- /dev/null
1101 1101 +++ b/fred
1102 1102 @@ -0,0 +1,1 @@
1103 1103 +bar
1104 1104 $ hg log -v --template '{rev} {file_copies}\n' -r .
1105 1105 3 barney (foo)
1106 1106
1107 1107
1108 1108 refresh omitting an added file
1109 1109
1110 1110 $ hg qnew baz
1111 1111 $ echo newfile > newfile
1112 1112 $ hg add newfile
1113 1113 $ hg qrefresh
1114 1114 $ hg st -A newfile
1115 1115 C newfile
1116 1116 $ hg qrefresh -X newfile
1117 1117 $ hg st -A newfile
1118 1118 A newfile
1119 1119 $ hg revert newfile
1120 1120 $ rm newfile
1121 1121 $ hg qpop
1122 1122 popping baz
1123 1123 now at: bar
1124 1124
1125 1125 test qdel/qrm
1126 1126
1127 1127 $ hg qdel baz
1128 1128 $ echo p >> .hg/patches/series
1129 1129 $ hg qrm p
1130 1130 $ hg qser
1131 1131 bar
1132 1132
1133 1133 create a git patch
1134 1134
1135 1135 $ echo a > alexander
1136 1136 $ hg add alexander
1137 1137 $ hg qnew -f --git addalexander
1138 1138 $ grep diff .hg/patches/addalexander
1139 1139 diff --git a/alexander b/alexander
1140 1140
1141 1141
1142 1142 create a git binary patch
1143 1143
1144 1144 $ cat > writebin.py <<EOF
1145 1145 > import sys
1146 1146 > path = sys.argv[1]
1147 1147 > open(path, 'wb').write(b'BIN\x00ARY')
1148 1148 > EOF
1149 1149 $ "$PYTHON" writebin.py bucephalus
1150 1150
1151 1151 $ "$PYTHON" "$TESTDIR/md5sum.py" bucephalus
1152 1152 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1153 1153 $ hg add bucephalus
1154 1154 $ hg qnew -f --git addbucephalus
1155 1155 $ grep diff .hg/patches/addbucephalus
1156 1156 diff --git a/bucephalus b/bucephalus
1157 1157
1158 1158
1159 1159 check binary patches can be popped and pushed
1160 1160
1161 1161 $ hg qpop
1162 1162 popping addbucephalus
1163 1163 now at: addalexander
1164 1164 $ test -f bucephalus && echo % bucephalus should not be there
1165 1165 [1]
1166 1166 $ hg qpush
1167 1167 applying addbucephalus
1168 1168 now at: addbucephalus
1169 1169 $ test -f bucephalus
1170 1170 $ "$PYTHON" "$TESTDIR/md5sum.py" bucephalus
1171 1171 8ba2a2f3e77b55d03051ff9c24ad65e7 bucephalus
1172 1172
1173 1173
1174 1174
1175 1175 strip again
1176 1176
1177 1177 $ cd ..
1178 1178 $ hg init strip
1179 1179 $ cd strip
1180 1180 $ touch foo
1181 1181 $ hg add foo
1182 1182 $ hg ci -m 'add foo'
1183 1183 $ echo >> foo
1184 1184 $ hg ci -m 'change foo 1'
1185 1185 $ hg up -C 0
1186 1186 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1187 1187 $ echo 1 >> foo
1188 1188 $ hg ci -m 'change foo 2'
1189 1189 created new head
1190 1190 $ HGMERGE=true hg merge
1191 1191 merging foo
1192 1192 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1193 1193 (branch merge, don't forget to commit)
1194 1194 $ hg ci -m merge
1195 1195 $ hg log
1196 1196 changeset: 3:99615015637b
1197 1197 tag: tip
1198 1198 parent: 2:20cbbe65cff7
1199 1199 parent: 1:d2871fc282d4
1200 1200 user: test
1201 1201 date: Thu Jan 01 00:00:00 1970 +0000
1202 1202 summary: merge
1203 1203
1204 1204 changeset: 2:20cbbe65cff7
1205 1205 parent: 0:53245c60e682
1206 1206 user: test
1207 1207 date: Thu Jan 01 00:00:00 1970 +0000
1208 1208 summary: change foo 2
1209 1209
1210 1210 changeset: 1:d2871fc282d4
1211 1211 user: test
1212 1212 date: Thu Jan 01 00:00:00 1970 +0000
1213 1213 summary: change foo 1
1214 1214
1215 1215 changeset: 0:53245c60e682
1216 1216 user: test
1217 1217 date: Thu Jan 01 00:00:00 1970 +0000
1218 1218 summary: add foo
1219 1219
1220 1220 $ hg strip 1
1221 1221 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1222 1222 saved backup bundle to $TESTTMP/strip/.hg/strip-backup/*-backup.hg (glob)
1223 1223 $ checkundo strip
1224 1224 $ hg log
1225 1225 changeset: 1:20cbbe65cff7
1226 1226 tag: tip
1227 1227 user: test
1228 1228 date: Thu Jan 01 00:00:00 1970 +0000
1229 1229 summary: change foo 2
1230 1230
1231 1231 changeset: 0:53245c60e682
1232 1232 user: test
1233 1233 date: Thu Jan 01 00:00:00 1970 +0000
1234 1234 summary: add foo
1235 1235
1236 1236 $ cd ..
1237 1237
1238 1238
1239 1239 qclone
1240 1240
1241 1241 $ qlog()
1242 1242 > {
1243 1243 > echo 'main repo:'
1244 1244 > hg log --template ' rev {rev}: {desc}\n'
1245 1245 > echo 'patch repo:'
1246 1246 > hg -R .hg/patches log --template ' rev {rev}: {desc}\n'
1247 1247 > }
1248 1248 $ hg init qclonesource
1249 1249 $ cd qclonesource
1250 1250 $ echo foo > foo
1251 1251 $ hg add foo
1252 1252 $ hg ci -m 'add foo'
1253 1253 $ hg qinit
1254 1254 $ hg qnew patch1
1255 1255 $ echo bar >> foo
1256 1256 $ hg qrefresh -m 'change foo'
1257 1257 $ cd ..
1258 1258
1259 1259
1260 1260 repo with unversioned patch dir
1261 1261
1262 1262 $ hg qclone qclonesource failure
1263 1263 abort: versioned patch repository not found (see init --mq)
1264 1264 [255]
1265 1265
1266 1266 $ cd qclonesource
1267 1267 $ hg qinit -c
1268 1268 adding .hg/patches/patch1
1269 1269 $ hg qci -m checkpoint
1270 1270 $ qlog
1271 1271 main repo:
1272 1272 rev 1: change foo
1273 1273 rev 0: add foo
1274 1274 patch repo:
1275 1275 rev 0: checkpoint
1276 1276 $ cd ..
1277 1277
1278 1278
1279 1279 repo with patches applied
1280 1280
1281 1281 $ hg qclone qclonesource qclonedest
1282 1282 updating to branch default
1283 1283 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1284 1284 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1285 1285 $ cd qclonedest
1286 1286 $ qlog
1287 1287 main repo:
1288 1288 rev 0: add foo
1289 1289 patch repo:
1290 1290 rev 0: checkpoint
1291 1291 $ cd ..
1292 1292
1293 1293
1294 1294 repo with patches unapplied
1295 1295
1296 1296 $ cd qclonesource
1297 1297 $ hg qpop -a
1298 1298 popping patch1
1299 1299 patch queue now empty
1300 1300 $ qlog
1301 1301 main repo:
1302 1302 rev 0: add foo
1303 1303 patch repo:
1304 1304 rev 0: checkpoint
1305 1305 $ cd ..
1306 1306 $ hg qclone qclonesource qclonedest2
1307 1307 updating to branch default
1308 1308 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1309 1309 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1310 1310 $ cd qclonedest2
1311 1311 $ qlog
1312 1312 main repo:
1313 1313 rev 0: add foo
1314 1314 patch repo:
1315 1315 rev 0: checkpoint
1316 1316 $ cd ..
1317 1317
1318 1318
1319 1319 Issue1033: test applying on an empty file
1320 1320
1321 1321 $ hg init empty
1322 1322 $ cd empty
1323 1323 $ touch a
1324 1324 $ hg ci -Am addempty
1325 1325 adding a
1326 1326 $ echo a > a
1327 1327 $ hg qnew -f -e changea
1328 1328 $ hg qpop
1329 1329 popping changea
1330 1330 patch queue now empty
1331 1331 $ hg qpush
1332 1332 applying changea
1333 1333 now at: changea
1334 1334 $ cd ..
1335 1335
1336 1336 test qpush with --force, issue1087
1337 1337
1338 1338 $ hg init forcepush
1339 1339 $ cd forcepush
1340 1340 $ echo hello > hello.txt
1341 1341 $ echo bye > bye.txt
1342 1342 $ hg ci -Ama
1343 1343 adding bye.txt
1344 1344 adding hello.txt
1345 1345 $ hg qnew -d '0 0' empty
1346 1346 $ hg qpop
1347 1347 popping empty
1348 1348 patch queue now empty
1349 1349 $ echo world >> hello.txt
1350 1350
1351 1351
1352 1352 qpush should fail, local changes
1353 1353
1354 1354 $ hg qpush
1355 1355 abort: local changes found
1356 1356 [255]
1357 1357
1358 1358
1359 1359 apply force, should not discard changes with empty patch
1360 1360
1361 1361 $ hg qpush -f
1362 1362 applying empty
1363 1363 patch empty is empty
1364 1364 now at: empty
1365 1365 $ hg diff --config diff.nodates=True
1366 1366 diff -r d58265112590 hello.txt
1367 1367 --- a/hello.txt
1368 1368 +++ b/hello.txt
1369 1369 @@ -1,1 +1,2 @@
1370 1370 hello
1371 1371 +world
1372 1372 $ hg qdiff --config diff.nodates=True
1373 1373 diff -r 9ecee4f634e3 hello.txt
1374 1374 --- a/hello.txt
1375 1375 +++ b/hello.txt
1376 1376 @@ -1,1 +1,2 @@
1377 1377 hello
1378 1378 +world
1379 1379 $ hg log -l1 -p
1380 1380 changeset: 1:d58265112590
1381 1381 tag: empty
1382 1382 tag: qbase
1383 1383 tag: qtip
1384 1384 tag: tip
1385 1385 user: test
1386 1386 date: Thu Jan 01 00:00:00 1970 +0000
1387 1387 summary: imported patch empty
1388 1388
1389 1389
1390 1390 $ hg qref -d '0 0'
1391 1391 $ hg qpop
1392 1392 popping empty
1393 1393 patch queue now empty
1394 1394 $ echo universe >> hello.txt
1395 1395 $ echo universe >> bye.txt
1396 1396
1397 1397
1398 1398 qpush should fail, local changes
1399 1399
1400 1400 $ hg qpush
1401 1401 abort: local changes found
1402 1402 [255]
1403 1403
1404 1404
1405 1405 apply force, should discard changes in hello, but not bye
1406 1406
1407 1407 $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups'
1408 1408 applying empty
1409 1409 creating directory: $TESTTMP/forcepush/.hg/origbackups
1410 1410 saving current version of hello.txt as .hg/origbackups/hello.txt
1411 1411 patching file hello.txt
1412 1412 committing files:
1413 1413 hello.txt
1414 1414 committing manifest
1415 1415 committing changelog
1416 1416 now at: empty
1417 1417 $ hg st
1418 1418 M bye.txt
1419 1419 $ hg diff --config diff.nodates=True
1420 1420 diff -r ba252371dbc1 bye.txt
1421 1421 --- a/bye.txt
1422 1422 +++ b/bye.txt
1423 1423 @@ -1,1 +1,2 @@
1424 1424 bye
1425 1425 +universe
1426 1426 $ hg qdiff --config diff.nodates=True
1427 1427 diff -r 9ecee4f634e3 bye.txt
1428 1428 --- a/bye.txt
1429 1429 +++ b/bye.txt
1430 1430 @@ -1,1 +1,2 @@
1431 1431 bye
1432 1432 +universe
1433 1433 diff -r 9ecee4f634e3 hello.txt
1434 1434 --- a/hello.txt
1435 1435 +++ b/hello.txt
1436 1436 @@ -1,1 +1,3 @@
1437 1437 hello
1438 1438 +world
1439 1439 +universe
1440 1440
1441 1441 test that the previous call to qpush with -f (--force) and --config actually put
1442 1442 the orig files out of the working copy
1443 1443 $ ls .hg/origbackups
1444 1444 hello.txt
1445 1445
1446 1446 test popping revisions not in working dir ancestry
1447 1447
1448 1448 $ hg qseries -v
1449 1449 0 A empty
1450 1450 $ hg up qparent
1451 1451 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1452 1452 $ hg qpop
1453 1453 popping empty
1454 1454 patch queue now empty
1455 1455
1456 1456 $ cd ..
1457 1457 $ hg init deletion-order
1458 1458 $ cd deletion-order
1459 1459
1460 1460 $ touch a
1461 1461 $ hg ci -Aqm0
1462 1462
1463 1463 $ hg qnew rename-dir
1464 1464 $ hg rm a
1465 1465 $ hg qrefresh
1466 1466
1467 1467 $ mkdir a b
1468 1468 $ touch a/a b/b
1469 1469 $ hg add -q a b
1470 1470 $ hg qrefresh
1471 1471
1472 1472
1473 1473 test popping must remove files added in subdirectories first
1474 1474
1475 1475 $ hg qpop
1476 1476 popping rename-dir
1477 1477 patch queue now empty
1478 1478 $ cd ..
1479 1479
1480 1480
1481 1481 test case preservation through patch pushing especially on case
1482 1482 insensitive filesystem
1483 1483
1484 1484 $ hg init casepreserve
1485 1485 $ cd casepreserve
1486 1486
1487 1487 $ hg qnew add-file1
1488 1488 $ echo a > TeXtFiLe.TxT
1489 1489 $ hg add TeXtFiLe.TxT
1490 1490 $ hg qrefresh
1491 1491
1492 1492 $ hg qnew add-file2
1493 1493 $ echo b > AnOtHeRFiLe.TxT
1494 1494 $ hg add AnOtHeRFiLe.TxT
1495 1495 $ hg qrefresh
1496 1496
1497 1497 $ hg qnew modify-file
1498 1498 $ echo c >> AnOtHeRFiLe.TxT
1499 1499 $ hg qrefresh
1500 1500
1501 1501 $ hg qapplied
1502 1502 add-file1
1503 1503 add-file2
1504 1504 modify-file
1505 1505 $ hg qpop -a
1506 1506 popping modify-file
1507 1507 popping add-file2
1508 1508 popping add-file1
1509 1509 patch queue now empty
1510 1510
1511 1511 this qpush causes problems below, if case preservation on case
1512 1512 insensitive filesystem is not enough:
1513 1513 (1) unexpected "adding ..." messages are shown
1514 1514 (2) patching fails in modification of (1) files
1515 1515
1516 1516 $ hg qpush -a
1517 1517 applying add-file1
1518 1518 applying add-file2
1519 1519 applying modify-file
1520 1520 now at: modify-file
1521 1521
1522 1522 Proper phase default with mq:
1523 1523
1524 1524 1. mq.secret=false
1525 1525
1526 1526 $ rm .hg/store/phaseroots
1527 1527 $ hg phase 'qparent::'
1528 1528 -1: public
1529 1529 0: draft
1530 1530 1: draft
1531 1531 2: draft
1532 1532 $ echo '[mq]' >> $HGRCPATH
1533 1533 $ echo 'secret=true' >> $HGRCPATH
1534 1534 $ rm -f .hg/store/phaseroots
1535 1535 $ hg phase 'qparent::'
1536 1536 -1: public
1537 1537 0: secret
1538 1538 1: secret
1539 1539 2: secret
1540 1540
1541 1541 Test that qfinish change phase when mq.secret=true
1542 1542
1543 1543 $ hg qfinish qbase
1544 1544 patch add-file1 finalized without changeset message
1545 1545 $ hg phase 'all()'
1546 1546 0: draft
1547 1547 1: secret
1548 1548 2: secret
1549 1549
1550 1550 Test that qfinish respect phases.new-commit setting
1551 1551
1552 1552 $ echo '[phases]' >> $HGRCPATH
1553 1553 $ echo 'new-commit=secret' >> $HGRCPATH
1554 1554 $ hg qfinish qbase
1555 1555 patch add-file2 finalized without changeset message
1556 1556 $ hg phase 'all()'
1557 1557 0: draft
1558 1558 1: secret
1559 1559 2: secret
1560 1560
1561 1561 (restore env for next test)
1562 1562
1563 1563 $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
1564 1564 $ cp $TESTTMP/sedtmp $HGRCPATH
1565 1565 $ hg qimport -r 1 --name add-file2
1566 1566
1567 1567 Test that qfinish preserve phase when mq.secret=false
1568 1568
1569 1569 $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
1570 1570 $ cp $TESTTMP/sedtmp $HGRCPATH
1571 1571 $ hg qfinish qbase
1572 1572 patch add-file2 finalized without changeset message
1573 1573 $ hg phase 'all()'
1574 1574 0: draft
1575 1575 1: secret
1576 1576 2: secret
1577 1577
1578 1578 Test that secret mq patch does not break hgweb
1579 1579
1580 1580 $ cat > hgweb.cgi <<HGWEB
1581 1581 > from mercurial import demandimport; demandimport.enable()
1582 1582 > from mercurial.hgweb import hgweb
1583 1583 > from mercurial.hgweb import wsgicgi
1584 > import cgitb
1585 > cgitb.enable()
1586 1584 > app = hgweb(b'.', b'test')
1587 1585 > wsgicgi.launch(app)
1588 1586 > HGWEB
1589 1587 $ . "$TESTDIR/cgienv"
1590 1588 #if msys
1591 1589 $ PATH_INFO=//tags; export PATH_INFO
1592 1590 #else
1593 1591 $ PATH_INFO=/tags; export PATH_INFO
1594 1592 #endif
1595 1593 $ QUERY_STRING='style=raw'
1596 1594 $ "$PYTHON" hgweb.cgi | grep '^tip'
1597 1595 tip [0-9a-f]{40} (re)
1598 1596
1599 1597 $ cd ..
1600 1598
1601 1599 Test interaction with revset (issue4426)
1602 1600
1603 1601 $ hg init issue4426
1604 1602 $ cd issue4426
1605 1603
1606 1604 $ echo a > a
1607 1605 $ hg ci -Am a
1608 1606 adding a
1609 1607 $ echo a >> a
1610 1608 $ hg ci -m a
1611 1609 $ echo a >> a
1612 1610 $ hg ci -m a
1613 1611 $ hg qimport -r 0::
1614 1612
1615 1613 reimport things
1616 1614
1617 1615 $ hg qimport -r 1::
1618 1616 abort: revision 2 is already managed
1619 1617 [255]
1620 1618
1621 1619
1622 1620 $ cd ..
@@ -1,66 +1,60 b''
1 1 #require no-msys # MSYS will translate web paths as if they were file paths
2 2
3 3 This tests if CGI files from after d0db3462d568 but
4 4 before d74fc8dec2b4 still work.
5 5
6 6 $ hg init test
7 7 $ cat >hgweb.cgi <<HGWEB
8 8 > #!$PYTHON
9 9 > #
10 10 > # An example CGI script to use hgweb, edit as necessary
11 11 >
12 > import cgitb
13 > cgitb.enable()
14 >
15 12 > from mercurial import demandimport; demandimport.enable()
16 13 > from mercurial.hgweb import hgweb
17 14 > from mercurial.hgweb import wsgicgi
18 15 > from mercurial.hgweb.request import wsgiapplication
19 16 >
20 17 > def make_web_app():
21 18 > return hgweb(b"test", b"Empty test repository")
22 19 >
23 20 > wsgicgi.launch(wsgiapplication(make_web_app))
24 21 > HGWEB
25 22
26 23 $ chmod 755 hgweb.cgi
27 24
28 25 $ cat >hgweb.config <<HGWEBDIRCONF
29 26 > [paths]
30 27 > test = test
31 28 > HGWEBDIRCONF
32 29
33 30 $ cat >hgwebdir.cgi <<HGWEBDIR
34 31 > #!$PYTHON
35 32 > #
36 33 > # An example CGI script to export multiple hgweb repos, edit as necessary
37 34 >
38 > import cgitb
39 > cgitb.enable()
40 >
41 35 > from mercurial import demandimport; demandimport.enable()
42 36 > from mercurial.hgweb import hgwebdir
43 37 > from mercurial.hgweb import wsgicgi
44 38 > from mercurial.hgweb.request import wsgiapplication
45 39 >
46 40 > def make_web_app():
47 41 > return hgwebdir(b"hgweb.config")
48 42 >
49 43 > wsgicgi.launch(wsgiapplication(make_web_app))
50 44 > HGWEBDIR
51 45
52 46 $ chmod 755 hgwebdir.cgi
53 47
54 48 $ . "$TESTDIR/cgienv"
55 49 $ "$PYTHON" hgweb.cgi > page1
56 50 $ "$PYTHON" hgwebdir.cgi > page2
57 51
58 52 $ PATH_INFO="/test/"
59 53 $ PATH_TRANSLATED="/var/something/test.cgi"
60 54 $ REQUEST_URI="/test/test/"
61 55 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
62 56 $ SCRIPT_URL="/test/test/"
63 57 $ "$PYTHON" hgwebdir.cgi > page3
64 58
65 59 $ grep -i error page1 page2 page3
66 60 [1]
@@ -1,60 +1,54 b''
1 1 #require no-msys # MSYS will translate web paths as if they were file paths
2 2
3 3 This is a rudimentary test of the CGI files as of d74fc8dec2b4.
4 4
5 5 $ hg init test
6 6
7 7 $ cat >hgweb.cgi <<HGWEB
8 8 > #!$PYTHON
9 9 > #
10 10 > # An example CGI script to use hgweb, edit as necessary
11 11 >
12 > import cgitb
13 > cgitb.enable()
14 >
15 12 > from mercurial import demandimport; demandimport.enable()
16 13 > from mercurial.hgweb import hgweb
17 14 > from mercurial.hgweb import wsgicgi
18 15 >
19 16 > application = hgweb(b"test", b"Empty test repository")
20 17 > wsgicgi.launch(application)
21 18 > HGWEB
22 19
23 20 $ chmod 755 hgweb.cgi
24 21
25 22 $ cat >hgweb.config <<HGWEBDIRCONF
26 23 > [paths]
27 24 > test = test
28 25 > HGWEBDIRCONF
29 26
30 27 $ cat >hgwebdir.cgi <<HGWEBDIR
31 28 > #!$PYTHON
32 29 > #
33 30 > # An example CGI script to export multiple hgweb repos, edit as necessary
34 31 >
35 > import cgitb
36 > cgitb.enable()
37 >
38 32 > from mercurial import demandimport; demandimport.enable()
39 33 > from mercurial.hgweb import hgwebdir
40 34 > from mercurial.hgweb import wsgicgi
41 35 >
42 36 > application = hgwebdir(b"hgweb.config")
43 37 > wsgicgi.launch(application)
44 38 > HGWEBDIR
45 39
46 40 $ chmod 755 hgwebdir.cgi
47 41
48 42 $ . "$TESTDIR/cgienv"
49 43 $ "$PYTHON" hgweb.cgi > page1
50 44 $ "$PYTHON" hgwebdir.cgi > page2
51 45
52 46 $ PATH_INFO="/test/"
53 47 $ PATH_TRANSLATED="/var/something/test.cgi"
54 48 $ REQUEST_URI="/test/test/"
55 49 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
56 50 $ SCRIPT_URL="/test/test/"
57 51 $ "$PYTHON" hgwebdir.cgi > page3
58 52
59 53 $ grep -i error page1 page2 page3
60 54 [1]
@@ -1,76 +1,74 b''
1 1 #require no-msys # MSYS will translate web paths as if they were file paths
2 2
3 3 This tests if CGI files from before d0db3462d568 still work.
4 4
5 5 $ hg init test
6 6 $ cat >hgweb.cgi <<HGWEB
7 7 > #!"$PYTHON"
8 8 > #
9 9 > # An example CGI script to use hgweb, edit as necessary
10 10 >
11 > import cgitb, os, sys
12 > cgitb.enable()
11 > import os, sys
13 12 >
14 13 > # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
15 14 > from mercurial import hgweb
16 15 >
17 16 > h = hgweb.hgweb(b"test", b"Empty test repository")
18 17 > h.run()
19 18 > HGWEB
20 19
21 20 $ chmod 755 hgweb.cgi
22 21
23 22 $ cat >hgweb.config <<HGWEBDIRCONF
24 23 > [paths]
25 24 > test = test
26 25 > HGWEBDIRCONF
27 26
28 27 $ cat >hgwebdir.cgi <<HGWEBDIR
29 28 > #!"$PYTHON"
30 29 > #
31 30 > # An example CGI script to export multiple hgweb repos, edit as necessary
32 31 >
33 > import cgitb, sys
34 > cgitb.enable()
32 > import sys
35 33 >
36 34 > # sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install
37 35 > from mercurial import hgweb
38 36 >
39 37 > # The config file looks like this. You can have paths to individual
40 38 > # repos, collections of repos in a directory tree, or both.
41 39 > #
42 40 > # [paths]
43 41 > # virtual/path = /real/path
44 42 > # virtual/path = /real/path
45 43 > #
46 44 > # [collections]
47 45 > # /prefix/to/strip/off = /root/of/tree/full/of/repos
48 46 > #
49 47 > # collections example: say directory tree /foo contains repos /foo/bar,
50 48 > # /foo/quux/baz. Give this config section:
51 49 > # [collections]
52 50 > # /foo = /foo
53 51 > # Then repos will list as bar and quux/baz.
54 52 >
55 53 > # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
56 54 > # or use a dictionary with entries like 'virtual/path': '/real/path'
57 55 >
58 56 > h = hgweb.hgwebdir(b"hgweb.config")
59 57 > h.run()
60 58 > HGWEBDIR
61 59
62 60 $ chmod 755 hgwebdir.cgi
63 61
64 62 $ . "$TESTDIR/cgienv"
65 63 $ "$PYTHON" hgweb.cgi > page1
66 64 $ "$PYTHON" hgwebdir.cgi > page2
67 65
68 66 $ PATH_INFO="/test/"
69 67 $ PATH_TRANSLATED="/var/something/test.cgi"
70 68 $ REQUEST_URI="/test/test/"
71 69 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/"
72 70 $ SCRIPT_URL="/test/test/"
73 71 $ "$PYTHON" hgwebdir.cgi > page3
74 72
75 73 $ grep -i error page1 page2 page3
76 74 [1]
@@ -1,95 +1,93 b''
1 1 #require no-msys # MSYS will translate web paths as if they were file paths
2 2
3 3 This is a test of the push wire protocol over CGI-based hgweb.
4 4
5 5 initialize repository
6 6
7 7 $ hg init r
8 8 $ cd r
9 9 $ echo a > a
10 10 $ hg ci -A -m "0"
11 11 adding a
12 12 $ echo '[web]' > .hg/hgrc
13 13 $ echo 'allow_push = *' >> .hg/hgrc
14 14 $ echo 'push_ssl = false' >> .hg/hgrc
15 15
16 16 create hgweb invocation script
17 17
18 18 $ cat >hgweb.cgi <<HGWEB
19 > import cgitb
20 > cgitb.enable()
21 19 > from mercurial import demandimport; demandimport.enable()
22 20 > from mercurial.hgweb import hgweb
23 21 > from mercurial.hgweb import wsgicgi
24 22 > application = hgweb(b'.', b'test repository')
25 23 > wsgicgi.launch(application)
26 24 > HGWEB
27 25 $ chmod 755 hgweb.cgi
28 26
29 27 test preparation
30 28
31 29 $ . "$TESTDIR/cgienv"
32 30 $ REQUEST_METHOD="POST"; export REQUEST_METHOD
33 31 $ CONTENT_TYPE="application/octet-stream"; export CONTENT_TYPE
34 32 $ hg bundle --type v1 --all bundle.hg
35 33 1 changesets found
36 34 $ CONTENT_LENGTH=279; export CONTENT_LENGTH;
37 35
38 36 expect failure because heads doesn't match (formerly known as 'unsynced changes')
39 37
40 38 $ QUERY_STRING="cmd=unbundle&heads=0000000000000000000000000000000000000000"; export QUERY_STRING
41 39 $ "$PYTHON" hgweb.cgi <bundle.hg >page1 2>&1
42 40 $ cat page1
43 41 Status: 200 Script output follows\r (esc)
44 42 Content-Type: application/mercurial-0.1\r (esc)
45 43 Content-Length: 64\r (esc)
46 44 \r (esc)
47 45 0
48 46 repository changed while preparing changes - please try again
49 47
50 48 successful force push
51 49
52 50 $ QUERY_STRING="cmd=unbundle&heads=666f726365"; export QUERY_STRING
53 51 $ "$PYTHON" hgweb.cgi <bundle.hg >page2 2>&1
54 52 $ cat page2
55 53 Status: 200 Script output follows\r (esc)
56 54 Content-Type: application/mercurial-0.1\r (esc)
57 55 Content-Length: 102\r (esc)
58 56 \r (esc)
59 57 1
60 58 adding changesets
61 59 adding manifests
62 60 adding file changes
63 61 added 0 changesets with 0 changes to 1 files
64 62
65 63 successful push, list of heads
66 64
67 65 $ QUERY_STRING="cmd=unbundle&heads=f7b1eb17ad24730a1651fccd46c43826d1bbc2ac"; export QUERY_STRING
68 66 $ "$PYTHON" hgweb.cgi <bundle.hg >page3 2>&1
69 67 $ cat page3
70 68 Status: 200 Script output follows\r (esc)
71 69 Content-Type: application/mercurial-0.1\r (esc)
72 70 Content-Length: 102\r (esc)
73 71 \r (esc)
74 72 1
75 73 adding changesets
76 74 adding manifests
77 75 adding file changes
78 76 added 0 changesets with 0 changes to 1 files
79 77
80 78 successful push, SHA1 hash of heads (unbundlehash capability)
81 79
82 80 $ QUERY_STRING="cmd=unbundle&heads=686173686564 5a785a5f9e0d433b88ed862b206b011b0c3a9d13"; export QUERY_STRING
83 81 $ "$PYTHON" hgweb.cgi <bundle.hg >page4 2>&1
84 82 $ cat page4
85 83 Status: 200 Script output follows\r (esc)
86 84 Content-Type: application/mercurial-0.1\r (esc)
87 85 Content-Length: 102\r (esc)
88 86 \r (esc)
89 87 1
90 88 adding changesets
91 89 adding manifests
92 90 adding file changes
93 91 added 0 changesets with 0 changes to 1 files
94 92
95 93 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now