##// END OF EJS Templates
bisect: track the current changeset (issue3382)...
Bryan O'Sullivan -
r16647:14913fcb default
parent child Browse files
Show More
@@ -563,6 +563,11 b' def bisect(ui, repo, rev=None, extra=Non'
563 563
564 564 hg log -r "bisect(pruned)"
565 565
566 - see the changeset currently being bisected (especially useful
567 if running with -U/--noupdate)::
568
569 hg log -r "bisect(current)"
570
566 571 - see all changesets that took part in the current bisection::
567 572
568 573 hg log -r "bisect(range)"
@@ -647,8 +652,18 b' def bisect(ui, repo, rev=None, extra=Non'
647 652 if command:
648 653 changesets = 1
649 654 try:
655 node = state['current'][0]
656 except LookupError:
657 if noupdate:
658 raise util.Abort(_('current bisect revision is unknown - '
659 'start a new bisect to fix'))
660 node, p2 = repo.dirstate.parents()
661 if p2 != nullid:
662 raise util.Abort(_('current bisect revision is a merge'))
663 try:
650 664 while changesets:
651 665 # update state
666 state['current'] = [node]
652 667 hbisect.save_state(repo, state)
653 668 status = util.system(command, out=ui.fout)
654 669 if status == 125:
@@ -662,7 +677,7 b' def bisect(ui, repo, rev=None, extra=Non'
662 677 raise util.Abort(_("%s killed") % command)
663 678 else:
664 679 transition = "bad"
665 ctx = scmutil.revsingle(repo, rev)
680 ctx = scmutil.revsingle(repo, rev, node)
666 681 rev = None # clear for future iterations
667 682 state[transition].append(ctx.node())
668 683 ui.status(_('Changeset %d:%s: %s\n') % (ctx, ctx, transition))
@@ -670,9 +685,12 b' def bisect(ui, repo, rev=None, extra=Non'
670 685 # bisect
671 686 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
672 687 # update to next check
673 cmdutil.bailifchanged(repo)
674 hg.clean(repo, nodes[0], show_stats=False)
688 node = nodes[0]
689 if not noupdate:
690 cmdutil.bailifchanged(repo)
691 hg.clean(repo, node, show_stats=False)
675 692 finally:
693 state['current'] = [node]
676 694 hbisect.save_state(repo, state)
677 695 print_result(nodes, good)
678 696 return
@@ -704,6 +722,8 b' def bisect(ui, repo, rev=None, extra=Non'
704 722 if extendnode is not None:
705 723 ui.write(_("Extending search to changeset %d:%s\n"
706 724 % (extendnode.rev(), extendnode)))
725 state['current'] = [extendnode.node()]
726 hbisect.save_state(repo, state)
707 727 if noupdate:
708 728 return
709 729 cmdutil.bailifchanged(repo)
@@ -723,6 +743,8 b' def bisect(ui, repo, rev=None, extra=Non'
723 743 ui.write(_("Testing changeset %d:%s "
724 744 "(%d changesets remaining, ~%d tests)\n")
725 745 % (rev, short(node), changesets, tests))
746 state['current'] = [node]
747 hbisect.save_state(repo, state)
726 748 if not noupdate:
727 749 cmdutil.bailifchanged(repo)
728 750 return hg.clean(repo, node)
@@ -132,7 +132,7 b' def bisect(changelog, state):'
132 132
133 133
134 134 def load_state(repo):
135 state = {'good': [], 'bad': [], 'skip': []}
135 state = {'current': [], 'good': [], 'bad': [], 'skip': []}
136 136 if os.path.exists(repo.join("bisect.state")):
137 137 for l in repo.opener("bisect.state"):
138 138 kind, node = l[:-1].split()
@@ -164,10 +164,11 b' def get(repo, status):'
164 164 - ``pruned`` : csets that are goods, bads or skipped
165 165 - ``untested`` : csets whose fate is yet unknown
166 166 - ``ignored`` : csets ignored due to DAG topology
167 - ``current`` : the cset currently being bisected
167 168 """
168 169 state = load_state(repo)
169 if status in ('good', 'bad', 'skip'):
170 return [repo.changelog.rev(n) for n in state[status]]
170 if status in ('good', 'bad', 'skip', 'current'):
171 return map(repo.changelog.rev, state[status])
171 172 else:
172 173 # In the floowing sets, we do *not* call 'bisect()' with more
173 174 # than one level of recusrsion, because that can be very, very
@@ -233,7 +234,7 b' def label(repo, node):'
233 234 if rev in get(repo, 'skip'):
234 235 # i18n: bisect changeset status
235 236 return _('skipped')
236 if rev in get(repo, 'untested'):
237 if rev in get(repo, 'untested') or rev in get(repo, 'current'):
237 238 # i18n: bisect changeset status
238 239 return _('untested')
239 240 if rev in get(repo, 'ignored'):
@@ -289,6 +289,7 b' def bisect(repo, subset, x):'
289 289 - ``pruned`` : csets that are goods, bads or skipped
290 290 - ``untested`` : csets whose fate is yet unknown
291 291 - ``ignored`` : csets ignored due to DAG topology
292 - ``current`` : the cset currently being bisected
292 293 """
293 294 status = getstring(x, _("bisect requires a string")).lower()
294 295 state = set(hbisect.get(repo, status))
@@ -224,6 +224,7 b' mark revsets instead of single revs'
224 224 Testing changeset 12:1941b52820a5 (23 changesets remaining, ~4 tests)
225 225 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
226 226 $ cat .hg/bisect.state
227 current 1941b52820a544549596820a8ae006842b0e2c64
227 228 skip 9d7d07bc967ca98ad0600c24953fd289ad5fa991
228 229 skip ce8f0998e922c179e80819d5066fbe46e2998784
229 230 skip e7fa0811edb063f6319531f0d0a865882138e180
@@ -396,6 +397,12 b' reproduce AssertionError, issue1445'
396 397 date: Thu Jan 01 00:00:06 1970 +0000
397 398 summary: msg 6
398 399
400 $ hg log -r "bisect(current)"
401 changeset: 5:7874a09ea728
402 user: test
403 date: Thu Jan 01 00:00:05 1970 +0000
404 summary: msg 5
405
399 406 $ hg log -r "bisect(skip)"
400 407 changeset: 1:5cd978ea5149
401 408 user: test
General Comments 0
You need to be logged in to leave comments. Login now