Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 5776:35ec669cdd43
bisect: handle search for bad to good transitions
Automatically detect whether we're looking for a bad to good
transition rather than the usual good to bad transition by detecting
when badrev is inside the good set and flipping good/bad.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 31 Dec 2007 18:20:34 -0600 |
parents | 2dd202a6e15b |
children | 9e97a7a0bb82 |
comparison
equal
deleted
inserted
replaced
5775:2dd202a6e15b | 5776:35ec669cdd43 |
---|---|
256 problem as good. Bisect will update your working directory to a | 256 problem as good. Bisect will update your working directory to a |
257 revision for testing. Once you have performed tests, mark the | 257 revision for testing. Once you have performed tests, mark the |
258 working directory as bad or good and bisect will either update to | 258 working directory as bad or good and bisect will either update to |
259 another candidate changeset or announce that it has found the bad | 259 another candidate changeset or announce that it has found the bad |
260 revision. | 260 revision. |
261 | |
262 Note: bisect expects bad revisions to be descendants of good | |
263 revisions. If you are looking for the point at which a problem was | |
264 fixed, then make the problem-free state \"bad\" and the | |
265 problematic state \"good.\" | |
266 """ | 261 """ |
267 # backward compatibility | 262 # backward compatibility |
268 if rev in "good bad reset init".split(): | 263 if rev in "good bad reset init".split(): |
269 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) | 264 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) |
270 cmd, rev, extra = rev, extra, None | 265 cmd, rev, extra = rev, extra, None |
315 | 310 |
316 if not state['good'] or not state['bad']: | 311 if not state['good'] or not state['bad']: |
317 return | 312 return |
318 | 313 |
319 # actually bisect | 314 # actually bisect |
320 node, changesets = hbisect.bisect(repo.changelog, state) | 315 node, changesets, good = hbisect.bisect(repo.changelog, state) |
321 if changesets == 0: | 316 if changesets == 0: |
322 ui.write(_("The first bad revision is:\n")) | 317 ui.write(_("The first %s revision is:\n") % (good and "good" or "bad")) |
323 displayer = cmdutil.show_changeset(ui, repo, {}) | 318 displayer = cmdutil.show_changeset(ui, repo, {}) |
324 displayer.show(changenode=node) | 319 displayer.show(changenode=node) |
325 elif node is not None: | 320 elif node is not None: |
326 # compute the approximate number of remaining tests | 321 # compute the approximate number of remaining tests |
327 tests, size = 0, 2 | 322 tests, size = 0, 2 |