Patchwork [2,of,3] histedit: check presence of statefile before deleting it

mail settings
Submitter Christian Delahousse
Date Oct. 7, 2015, 10:19 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/10900/
State Superseded
Headers show


Christian Delahousse - Oct. 7, 2015, 10:19 p.m.
# HG changeset patch
# User Christian Delahousse <>
# Date 1444169368 25200
#      Tue Oct 06 15:09:28 2015 -0700
# Node ID d7088586b95e2efd96f9e9d3a71a4346a211306d
# Parent  a4ca3731ba2ccb54d2a549876fa74f55a84216bb
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.


diff --git a/hgext/ b/hgext/
--- a/hgext/
+++ b/hgext/
@@ -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')