Differences between revisions 1 and 11 (spanning 10 versions)
Revision 1 as of 2006-05-09 15:13:05
Size: 2047
Editor: DavidMentre
Comment: d.: add document to bisect extension
Revision 11 as of 2008-03-25 16:37:07
Size: 2451
Editor: abuehl
Comment: built-in for Mercurial 1.0
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Mercurial includes an extension to look for bugs, called hbisect (adding the bisect command). ## page was renamed from UsingBisect
== Bisect Extension (hbisect) ==
Line 3: Line 4:
= Overview = '''Mercurial 1.0 includes bisect as a built-in command (see [:UpgradeNotes]).'''
Line 5: Line 6:
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. ''Author: Benoit Benissot''
Line 7: Line 8:
= Setup = === Overview ===
Line 9: Line 10:
Firstly, you need to configure your .hgrc to enable the extension by adding following lines: This extension (hbisect) eases looking for bugs by doing a binary search in O(log(n)). It adds the {{{bisect}}} command.

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 halfway between the good and the bad ones and lets you test it. If this revision is a good one, you mark it as good with {{{hg bisect good}}}, otherwise you mark it as bad with {{{hg bisect bad}}}. In both cases, bisect outputs a new revision to test, halfway between the good and the bad ones. You repeat until only one revision is left: the culprit.

=== Configuration ===

First you configure your $HOME/.hgrc to enable the extension by adding following lines (this is '''not''' needed for Mercurial 1.0):
Line 13: Line 20:
hbisect= hgext.hbisect=
Line 16: Line 23:
Then, the bisect command should be available: Then, the bisect command should be available (bisect is a built-in command in Mercurial 1.0):
Line 30: Line 37:
= Use = === Use ===
Line 32: Line 39:
To start a bug search, you must initialize bisect: To start a bug search, you initialize bisect:
Line 42: Line 49:
Then, you mark as good a revision known to be good: Then, you mark a revision known to be good:
Line 49: Line 56:
After the above command, bisect outputs a new revision to test. After each test, your mark it as good with: After the above command, bisect outputs a new revision to test. After each test, you mark it as good with:
Line 68: Line 75:
----
CategoryExtension

Bisect Extension (hbisect)

Mercurial 1.0 includes bisect as a built-in command (see [:UpgradeNotes]).

Author: Benoit Benissot

Overview

This extension (hbisect) eases looking for bugs by doing a binary search in O(log(n)). It adds the bisect command.

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 halfway between the good and the bad ones and lets you test it. If this revision is a good one, you mark it as good with hg bisect good, otherwise you mark it as bad with hg bisect bad. In both cases, bisect outputs a new revision to test, halfway between the good and the bad ones. You repeat until only one revision is left: the culprit.

Configuration

First you configure your $HOME/.hgrc to enable the extension by adding following lines (this is not needed for Mercurial 1.0):

[extensions]
hgext.hbisect=

Then, the bisect command should be available (bisect is a built-in command in Mercurial 1.0):

$ 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 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 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, you 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


CategoryExtension

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