changeset 26583:49b568a4e539

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.
author Christian Delahousse <cdelahousse@fb.com>
date Tue, 06 Oct 2015 15:09:28 -0700
parents 42b908673866
children e28102403d1b
files hgext/histedit.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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')