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