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 0 means good πŸ’–
  • status 125 means 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 revision 12:
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 foo or bar:
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 πŸ’…πŸŽ€πŸ«Ά