# HG changeset patch # User Benoit Boissinot # Date 1190478236 -7200 # Node ID 5b6e403601d19c9dd90b5d8bc0a5d56692839452 # Parent ba3dc78839686ccb285f4227a80356f7b13e6f8f bisect: do silent init if necessary diff --git a/hgext/hbisect.py b/hgext/hbisect.py --- a/hgext/hbisect.py +++ b/hgext/hbisect.py @@ -37,10 +37,9 @@ class bisect(object): self.ui = ui self.goodrevs = [] self.badrev = None - self.good_dirty = 0 - self.bad_dirty = 0 self.good_path = "good" self.bad_path = "bad" + self.is_reset = False if os.path.exists(os.path.join(self.path, self.good_path)): self.goodrevs = self.opener(self.good_path).read().splitlines() @@ -51,8 +50,10 @@ class bisect(object): self.badrev = hg.bin(r.pop(0)) def write(self): + if self.is_reset: + return if not os.path.isdir(self.path): - return + os.mkdir(self.path) f = self.opener(self.good_path, "w") f.write("\n".join([hg.hex(r) for r in self.goodrevs])) if len(self.goodrevs) > 0: @@ -81,6 +82,7 @@ class bisect(object): # Not sure about this #self.ui.write("Going back to tip\n") #self.repo.update(self.repo.changelog.tip()) + self.is_reset = True return 0 def num_ancestors(self, head=None, stop=None):