changeset 5717:18fdfafdb3e9

bisect: use bail_if_changed - switch to using existing bail_if_changed code - only abort when we're about to do an update
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Dec 2007 23:55:39 -0600
parents be367cbafe70
children 442c613fd4aa
files hgext/hbisect.py
diffstat 1 files changed, 1 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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):