HG(BISECT)
π hg bisect β subdivision search of changesets π
okay bestie, welcome to the hg bisect page, aka the manual for the Mercurial bisect command, and honestly? it's giving detective energy πβ¨
πΈ SYNOPSIS πΈ
hg bisect [-gbsr] [-U] [-c CMD] [REV]
π¦ DESCRIPTION π¦
so like, this command helps you find the changesets that introduced a problem π. here's the vibe:
- mark the earliest changeset you know is broken as bad
- then mark the latest changeset that's still totally fine as good
then bisect goes brrrr and updates your working directory to a revision for testing π
β unless you passed -U/--noupdate, in which case it stays put, no cap.
once you've done your lil tests, you mark the working directory as good or bad, and bisect will either update to another candidate changeset or straight up announce that it found the bad revision. main character moment fr fr π
as a shortcut, you can also just use the revision argument to mark a revision as good or bad without checking it out first. lazy girl math but make it efficient β¨
if you supply a command, it gets used for automatic bisection π. the environment variable HG_NODE will contain the ID of the changeset being tested. the exit status of the command decides how revisions get marked:
- status
0means good π - status
125means skip the revision π - status
127(command not found) will abort the bisection π - any other non-zero exit status means the revision is bad π
some examples, because we love a demo:
- start a bisection with known bad revision
34, and good revision12:
hg bisect --bad 34
hg bisect --good 12
- advance the current bisection by marking current revision as good or bad:
hg bisect --good
hg bisect --bad
- mark the current revision, or a known revision, to be skipped (e.g. if that revision is not usable because of another issue):
hg bisect --skip
hg bisect --skip 23
- skip all revisions that do not touch directories
fooorbar:
hg bisect --skip "!( file('path:foo') & file('path:bar') )"
- forget the current bisection:
hg bisect --reset
- use
'make && make tests'to automatically find the first broken revision:
hg bisect --reset
hg bisect --bad 34
hg bisect --good 12
hg bisect --command "make && make tests"
- see all changesets whose states are already known in the current bisection:
hg log -r "bisect(pruned)"
- see the changeset currently being bisected (especially useful if running with
-U/--noupdate):
hg log -r "bisect(current)"
- see all changesets that took part in the current bisection:
hg log -r "bisect(range)"
- you can even get a nice graph π¦:
hg log --graph -r "bisect(range)"
See hg help revisions.bisect for more about the bisect() predicate. iykyk π
Returns 0 on success. periodt. π
β¨ OPTIONS β¨
-r,--resetβ reset bisect state π (fresh start bestie)-g,--goodβ mark changeset good π-b,--badβ mark changeset bad π-s,--skipβ skip testing changeset π-e,--extendβ extend the bisect range π-c,--command <CMD>β use command to check changeset state π₯οΈβ¨-U,--noupdateβ do not update to target π« (stay right where you are, queen)
and that's the whole page, babe π this was HG(BISECT) β that's the manual name and the source/version tag all wrapped into one, and the page is dated the same. thanks for reading my ted talk, go find that bad revision and slay π
ππ«Ά
π¦ where this page comes from
- arch rolling: mercurial 7.2.4-1 Β· GPL
- fedora 43: mercurial 7.1.1-1.fc43 Β· GPL-2.0-or-later
- fedora 43: mercurial 7.1.1-2.fc43 Β· GPL-2.0-or-later
- fedora 44: mercurial 7.2-1.fc44 Β· GPL-2.0-or-later
- fedora 44: mercurial 7.2.4-1.fc44 Β· GPL-2.0-or-later
- nixos 26.05: mercurial 7.1.2
- nixos 26.05: mercurial-full 7.1.2
- nixpkgs unstable: mercurial 7.2.2
- nixpkgs unstable: mercurial-full 7.2.2
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms