Differences between revisions 1 and 2
Revision 1 as of 2006-05-09 15:13:05
Size: 2047
Editor: DavidMentre
Comment: d.: add document to bisect extension
Revision 2 as of 2006-05-09 15:16:23
Size: 2102
Editor: DavidMentre
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
This command comes from GIT. Its behaviour is fairly simple, it takes a first revision known to be correct (i.e. without the bug) and a last revision known to be bad (i.e. with the bug). The bisect extension ouputs a revision at half between the good and the bad one and let you test it. If this revision is a good one, your mark it as such with {{{hg bisect good}}}, otherwise your mark it as a bad one with {{{hg bisect bad}}}. In both cases, bisect outputs a new revision to test, until only one revision is left. This command comes from GIT. Its behaviour is fairly simple, it takes a first revision known to be correct (i.e. without the bug) and a last revision known to be bad (i.e. with the bug). The bisect extension ouputs a revision at half between the good and the bad one and let you test it. If this revision is a good one, your mark it as such with {{{hg bisect good}}}, otherwise your mark it as a bad one with {{{hg bisect bad}}}. In both cases, bisect outputs a new revision to test, at half between the good and the bad one, until only one revision is left: the culprit.

Mercurial includes an extension to look for bugs, called hbisect (adding the bisect command).

Overview

This command comes from GIT. Its behaviour is fairly simple, it takes a first revision known to be correct (i.e. without the bug) and a last revision known to be bad (i.e. with the bug). The bisect extension ouputs a revision at half between the good and the bad one and let you test it. If this revision is a good one, your mark it as such with hg bisect good, otherwise your mark it as a bad one with hg bisect bad. In both cases, bisect outputs a new revision to test, at half between the good and the bad one, until only one revision is left: the culprit.

Setup

Firstly, you need to configure your .hgrc to enable the extension by adding following lines:

[extensions]
hbisect=

Then, the bisect command should be available:

$ hg bisect help
list of subcommands for the bisect extension

 bad     mark revision as bad and update to the next revision to test
 good    mark revision as good and update to the next revision to test
 help    show help for a given bisect subcommand or all subcommands
 init    start a new bisection
 next    find and update to the next revision to test
 reset   finish a bisection

Use

To start a bug search, you must initialize bisect:

$ hg bisect init

Usually, you have a bug in the tip, so you mark it as bad:

$ hg bisect bad

Then, you mark as good a revision known to be good:

$ hg bisect good ID-OF-KNOWN-GOOD
60 revisions left
Now testing 6df5bc5a4e5fb898fd52689dad1ffce7059aba3e

After the above command, bisect outputs a new revision to test. After each test, your mark it as good with:

$ hg bisect good
15 revisions left
Now testing 81d1c36e3205d2155fbccc49108dc55d8ba97758

or as bad with:

$ hg bisect bad
3 revisions left
Now testing f2a1d841d57eeb3cdbc078f6e0f56c83a3f86a25

Until the right one is found:

$ hg bisect bad
The first bad revision is : f2a1d841d57eeb3cdbc078f6e0f56c83a3f86a25

BisectExtension (last edited 2017-10-06 13:34:39 by tonfa)