histedit: check presence of statefile before deleting it
authorChristian Delahousse <cdelahousse@fb.com>
Tue, 06 Oct 2015 15:09:28 -0700
changeset 26583 49b568a4e539
parent 26582 42b908673866
child 26584 e28102403d1b
histedit: check presence of statefile before deleting it When the histeditstate class instance has it's clear() method called, there is nothing to check to see if the state file exists before deleting it. It may not exist, which would create an exception. This patch allows clear to be called at any time. This will be needed for the following patch.
hgext/histedit.py
--- a/hgext/histedit.py	Mon Oct 05 16:34:17 2015 -0700
+++ b/hgext/histedit.py	Tue Oct 06 15:09:28 2015 -0700
@@ -310,7 +310,8 @@
         return parentctxnode, rules, keep, topmost, replacements, backupfile
 
     def clear(self):
-        self.repo.vfs.unlink('histedit-state')
+        if self.inprogress():
+            self.repo.vfs.unlink('histedit-state')
 
     def inprogress(self):
         return self.repo.vfs.exists('histedit-state')