changeset 30065:ee21ed7fc7a2

bisect: extract the 'reset' logic into its own function This is part of small clean up movement. The bisect module seem more appropriate to host the bisect logic. The cleanup itself is motivated by some higher level cleanup around vfs and locking.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 24 Aug 2016 04:13:53 +0200
parents b24804f72116
children 5f93737d0ba8
files mercurial/commands.py mercurial/hbisect.py
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Aug 24 04:31:49 2016 +0200
+++ b/mercurial/commands.py	Wed Aug 24 04:13:53 2016 +0200
@@ -902,8 +902,7 @@
     cmdutil.checkunfinished(repo)
 
     if reset:
-        if repo.vfs.exists("bisect.state"):
-            repo.vfs.unlink("bisect.state")
+        hbisect.resetstate(repo)
         return
 
     state = hbisect.load_state(repo)
--- a/mercurial/hbisect.py	Wed Aug 24 04:31:49 2016 +0200
+++ b/mercurial/hbisect.py	Wed Aug 24 04:13:53 2016 +0200
@@ -159,6 +159,11 @@
                 f.write("%s %s\n" % (kind, hex(node)))
         f.close()
 
+def resetstate(repo):
+    """remove any bisect state from the repository"""
+    if repo.vfs.exists("bisect.state"):
+        repo.vfs.unlink("bisect.state")
+
 def get(repo, status):
     """
     Return a list of revision(s) that match the given status: