bisect: use bail_if_changed
authorMatt Mackall <mpm@selenic.com>
Thu, 27 Dec 2007 23:55:39 -0600
changeset 5717 18fdfafdb3e9
parent 5716 be367cbafe70
child 5718 442c613fd4aa
bisect: use bail_if_changed - switch to using existing bail_if_changed code - only abort when we're about to do an update
hgext/hbisect.py
--- a/hgext/hbisect.py	Thu Dec 27 23:55:39 2007 -0600
+++ b/hgext/hbisect.py	Thu Dec 27 23:55:39 2007 -0600
@@ -10,13 +10,6 @@
 from mercurial import hg, util, commands, cmdutil
 import os, sys, sets
 
-def check_clean(ui, repo):
-    merged = (nullid in repo.dirstate.parents())
-    modified, added, removed, deleted, unknown = repo.status()[:5]
-    if modified or added or removed or merged:
-        ui.warn("Repository is not clean, please commit or revert\n")
-        sys.exit(1)
-
 class bisect(object):
     """dichotomic search in the DAG of changesets"""
     def __init__(self, ui, repo):
@@ -56,7 +49,6 @@
         if os.path.isdir(self.path):
             raise util.Abort(_("bisect directory already exists\n"))
         os.mkdir(self.path)
-        check_clean(self.ui, self.repo)
         return 0
 
     def reset(self):
@@ -166,8 +158,8 @@
     def autonext(self):
         """find and update to the next revision to test"""
         rev = self.next()
-        check_clean(self.ui, self.repo)
         if rev is not None:
+            cmdutil.bail_if_changed(self.repo)
             return hg.clean(self.repo, rev)
 
     def autogood(self, rev=None):