##// END OF EJS Templates
bisect: move check_state into the bisect module...
Pierre-Yves David -
r30126:755730fc default
parent child Browse files
Show More
@@ -835,14 +835,6 b' def bisect(ui, repo, rev=None, extra=Non'
835
835
836 Returns 0 on success.
836 Returns 0 on success.
837 """
837 """
838 def checkstate(state):
839 if state['good'] and state['bad']:
840 return True
841 if not state['good']:
842 raise error.Abort(_('cannot bisect (no known good revisions)'))
843 else:
844 raise error.Abort(_('cannot bisect (no known bad revisions)'))
845
846 # backward compatibility
838 # backward compatibility
847 if rev in "good bad reset init".split():
839 if rev in "good bad reset init".split():
848 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n"))
840 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n"))
@@ -913,7 +905,7 b' def bisect(ui, repo, rev=None, extra=Non'
913 rev = None # clear for future iterations
905 rev = None # clear for future iterations
914 state[transition].append(ctx.node())
906 state[transition].append(ctx.node())
915 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
907 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
916 checkstate(state)
908 hbisect.checkstate(state)
917 # bisect
909 # bisect
918 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
910 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
919 # update to next check
911 # update to next check
@@ -928,7 +920,7 b' def bisect(ui, repo, rev=None, extra=Non'
928 hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
920 hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
929 return
921 return
930
922
931 checkstate(state)
923 hbisect.checkstate(state)
932
924
933 # actually bisect
925 # actually bisect
934 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
926 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
@@ -177,6 +177,17 b' def resetstate(repo):'
177 if repo.vfs.exists("bisect.state"):
177 if repo.vfs.exists("bisect.state"):
178 repo.vfs.unlink("bisect.state")
178 repo.vfs.unlink("bisect.state")
179
179
180 def checkstate(state):
181 """check we have both 'good' and 'bad' to define a range
182
183 Raise Abort exception otherwise."""
184 if state['good'] and state['bad']:
185 return True
186 if not state['good']:
187 raise error.Abort(_('cannot bisect (no known good revisions)'))
188 else:
189 raise error.Abort(_('cannot bisect (no known bad revisions)'))
190
180 def get(repo, status):
191 def get(repo, status):
181 """
192 """
182 Return a list of revision(s) that match the given status:
193 Return a list of revision(s) that match the given status:
General Comments 0
You need to be logged in to leave comments. Login now