| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 |
<meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" /> |
| 7 |
<title>hg bisect</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="hg-bisect"> |
| 12 |
<span id="hg-bisect-1"></span> |
| 13 |
<h1 class="title">hg bisect</h1> |
| 14 |
<h2 class="subtitle" id="subdivision-search-of-changesets">subdivision search of changesets</h2> |
| 15 |
|
| 16 |
<div class="contents htmlonly topic" id="contents"> |
| 17 |
<p class="topic-title"><a class="reference internal" href="#top">Contents</a></p> |
| 18 |
<ul class="simple"> |
| 19 |
<li><a class="reference internal" href="#synopsis" id="toc-entry-1">Synopsis</a></li> |
| 20 |
<li><a class="reference internal" href="#description" id="toc-entry-2">Description</a></li> |
| 21 |
<li><a class="reference internal" href="#options" id="toc-entry-3">Options</a></li> |
| 22 |
</ul> |
| 23 |
</div> |
| 24 |
<div class="section" id="synopsis"> |
| 25 |
<h1><a class="toc-backref" href="#contents">Synopsis</a></h1> |
| 26 |
<pre class="literal-block"> |
| 27 |
hg bisect [-gbsr] [-U] [-c CMD] [REV] |
| 28 |
</pre> |
| 29 |
</div> |
| 30 |
<div class="section" id="description"> |
| 31 |
<h1><a class="toc-backref" href="#contents">Description</a></h1> |
| 32 |
<p>This command helps to find changesets which introduce problems. To |
| 33 |
use, mark the earliest changeset you know exhibits the problem as |
| 34 |
bad, then mark the latest changeset which is free from the problem |
| 35 |
as good. Bisect will update your working directory to a revision |
| 36 |
for testing (unless the -U/--noupdate option is specified). Once |
| 37 |
you have performed tests, mark the working directory as good or |
| 38 |
bad, and bisect will either update to another candidate changeset |
| 39 |
or announce that it has found the bad revision.</p> |
| 40 |
<p>As a shortcut, you can also use the revision argument to mark a |
| 41 |
revision as good or bad without checking it out first.</p> |
| 42 |
<p>If you supply a command, it will be used for automatic bisection. |
| 43 |
The environment variable HG_NODE will contain the ID of the |
| 44 |
changeset being tested. The exit status of the command will be |
| 45 |
used to mark revisions as good or bad: status 0 means good, 125 |
| 46 |
means to skip the revision, 127 (command not found) will abort the |
| 47 |
bisection, and any other non-zero exit status means the revision |
| 48 |
is bad.</p> |
| 49 |
<div class="verbose docutils container"> |
| 50 |
<p>Some examples:</p> |
| 51 |
<ul> |
| 52 |
<li><p class="first">start a bisection with known bad revision 34, and good revision 12:</p> |
| 53 |
<pre class="literal-block"> |
| 54 |
hg bisect --bad 34 |
| 55 |
hg bisect --good 12 |
| 56 |
</pre> |
| 57 |
</li> |
| 58 |
<li><p class="first">advance the current bisection by marking current revision as good or |
| 59 |
bad:</p> |
| 60 |
<pre class="literal-block"> |
| 61 |
hg bisect --good |
| 62 |
hg bisect --bad |
| 63 |
</pre> |
| 64 |
</li> |
| 65 |
<li><p class="first">mark the current revision, or a known revision, to be skipped (e.g. if |
| 66 |
that revision is not usable because of another issue):</p> |
| 67 |
<pre class="literal-block"> |
| 68 |
hg bisect --skip |
| 69 |
hg bisect --skip 23 |
| 70 |
</pre> |
| 71 |
</li> |
| 72 |
<li><p class="first">skip all revisions that do not touch directories <tt class="docutils literal">foo</tt> or <tt class="docutils literal">bar</tt>:</p> |
| 73 |
<pre class="literal-block"> |
| 74 |
hg bisect --skip "!( file('path:foo') & file('path:bar') )" |
| 75 |
</pre> |
| 76 |
</li> |
| 77 |
<li><p class="first">forget the current bisection:</p> |
| 78 |
<pre class="literal-block"> |
| 79 |
hg bisect --reset |
| 80 |
</pre> |
| 81 |
</li> |
| 82 |
<li><p class="first">use 'make && make tests' to automatically find the first broken |
| 83 |
revision:</p> |
| 84 |
<pre class="literal-block"> |
| 85 |
hg bisect --reset |
| 86 |
hg bisect --bad 34 |
| 87 |
hg bisect --good 12 |
| 88 |
hg bisect --command "make && make tests" |
| 89 |
</pre> |
| 90 |
</li> |
| 91 |
<li><p class="first">see all changesets whose states are already known in the current |
| 92 |
bisection:</p> |
| 93 |
<pre class="literal-block"> |
| 94 |
hg log -r "bisect(pruned)" |
| 95 |
</pre> |
| 96 |
</li> |
| 97 |
<li><p class="first">see the changeset currently being bisected (especially useful |
| 98 |
if running with -U/--noupdate):</p> |
| 99 |
<pre class="literal-block"> |
| 100 |
hg log -r "bisect(current)" |
| 101 |
</pre> |
| 102 |
</li> |
| 103 |
<li><p class="first">see all changesets that took part in the current bisection:</p> |
| 104 |
<pre class="literal-block"> |
| 105 |
hg log -r "bisect(range)" |
| 106 |
</pre> |
| 107 |
</li> |
| 108 |
<li><p class="first">you can even get a nice graph:</p> |
| 109 |
<pre class="literal-block"> |
| 110 |
hg log --graph -r "bisect(range)" |
| 111 |
</pre> |
| 112 |
</li> |
| 113 |
</ul> |
| 114 |
<p>See <a class="reference external" href="hg.1.html#revisions.bisect"><tt class="docutils literal">hg help revisions.bisect</tt></a> for more about the <cite>bisect()</cite> predicate.</p> |
| 115 |
</div> |
| 116 |
<p>Returns 0 on success.</p> |
| 117 |
</div> |
| 118 |
<div class="section" id="options"> |
| 119 |
<h1><a class="toc-backref" href="#contents">Options</a></h1> |
| 120 |
<table class="docutils option-list" frame="void" rules="none"> |
| 121 |
<col class="option" /> |
| 122 |
<col class="description" /> |
| 123 |
<tbody valign="top"> |
| 124 |
<tr><td class="option-group"> |
| 125 |
<kbd><span class="option">-r</span>, <span class="option">--reset</span></kbd></td> |
| 126 |
<td>reset bisect state</td></tr> |
| 127 |
<tr><td class="option-group"> |
| 128 |
<kbd><span class="option">-g</span>, <span class="option">--good</span></kbd></td> |
| 129 |
<td>mark changeset good</td></tr> |
| 130 |
<tr><td class="option-group"> |
| 131 |
<kbd><span class="option">-b</span>, <span class="option">--bad</span></kbd></td> |
| 132 |
<td>mark changeset bad</td></tr> |
| 133 |
<tr><td class="option-group"> |
| 134 |
<kbd><span class="option">-s</span>, <span class="option">--skip</span></kbd></td> |
| 135 |
<td>skip testing changeset</td></tr> |
| 136 |
<tr><td class="option-group"> |
| 137 |
<kbd><span class="option">-e</span>, <span class="option">--extend</span></kbd></td> |
| 138 |
<td>extend the bisect range</td></tr> |
| 139 |
<tr><td class="option-group" colspan="2"> |
| 140 |
<kbd><span class="option">-c</span>, <span class="option">--command <var><CMD></var></span></kbd></td> |
| 141 |
</tr> |
| 142 |
<tr><td> </td><td>use command to check changeset state</td></tr> |
| 143 |
<tr><td class="option-group"> |
| 144 |
<kbd><span class="option">-U</span>, <span class="option">--noupdate</span></kbd></td> |
| 145 |
<td>do not update to target</td></tr> |
| 146 |
</tbody> |
| 147 |
</table> |
| 148 |
</div> |
| 149 |
</div> |
| 150 |
</body> |
| 151 |
</html> |