##// END OF EJS Templates
bisect: set HG_NODE when runing a command...
Bryan O'Sullivan -
r16648:1388cc71 default
parent child Browse files
Show More
@@ -520,10 +520,12 b' def bisect(ui, repo, rev=None, extra=Non'
520 revision as good or bad without checking it out first.
520 revision as good or bad without checking it out first.
521
521
522 If you supply a command, it will be used for automatic bisection.
522 If you supply a command, it will be used for automatic bisection.
523 Its exit status will be used to mark revisions as good or bad:
523 The environment variable HG_NODE will contain the ID of the
524 status 0 means good, 125 means to skip the revision, 127
524 changeset being tested. The exit status of the command will be
525 (command not found) will abort the bisection, and any other
525 used to mark revisions as good or bad: status 0 means good, 125
526 non-zero exit status means the revision is bad.
526 means to skip the revision, 127 (command not found) will abort the
527 bisection, and any other non-zero exit status means the revision
528 is bad.
527
529
528 .. container:: verbose
530 .. container:: verbose
529
531
@@ -665,7 +667,9 b' def bisect(ui, repo, rev=None, extra=Non'
665 # update state
667 # update state
666 state['current'] = [node]
668 state['current'] = [node]
667 hbisect.save_state(repo, state)
669 hbisect.save_state(repo, state)
668 status = util.system(command, out=ui.fout)
670 status = util.system(command,
671 environ={'HG_NODE': hex(node)},
672 out=ui.fout)
669 if status == 125:
673 if status == 125:
670 transition = "skip"
674 transition = "skip"
671 elif status == 0:
675 elif status == 0:
@@ -473,3 +473,40 b' test bisecting command'
473 date: Thu Jan 01 00:00:06 1970 +0000
473 date: Thu Jan 01 00:00:06 1970 +0000
474 summary: msg 6
474 summary: msg 6
475
475
476
477
478 test bisecting via a command without updating the working dir, and
479 ensure that the bisect state file is updated before running a test
480 command
481
482 $ hg update null
483 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
484 $ cat > script.sh <<'EOF'
485 > #!/bin/sh
486 > test -n "$HG_NODE" || (echo HG_NODE missing; exit 127)
487 > current="`hg log -r \"bisect(current)\" --template {node}`"
488 > test "$current" = "$HG_NODE" || (echo current is bad: $current; exit 127)
489 > rev="`hg log -r $HG_NODE --template {rev}`"
490 > test "$rev" -ge 6
491 > EOF
492 $ chmod +x script.sh
493 $ hg bisect -r
494 $ hg bisect --good tip --noupdate
495 $ hg bisect --bad 0 --noupdate
496 Testing changeset 15:e7fa0811edb0 (31 changesets remaining, ~4 tests)
497 $ hg bisect --command "'`pwd`/script.sh' and some params" --noupdate
498 Changeset 15:e7fa0811edb0: good
499 Changeset 7:03750880c6b5: good
500 Changeset 3:b53bea5e2fcb: bad
501 Changeset 5:7874a09ea728: bad
502 Changeset 6:a3d5c6fdf0d3: good
503 The first good revision is:
504 changeset: 6:a3d5c6fdf0d3
505 user: test
506 date: Thu Jan 01 00:00:06 1970 +0000
507 summary: msg 6
508
509
510 ensure that we still don't have a working dir
511
512 $ hg parents
General Comments 0
You need to be logged in to leave comments. Login now