[PATCH 3 of 9] histedit: add clear method to remove state

David Soria Parra davidsp at fb.com
Thu Oct 16 12:34:39 CDT 2014


# HG changeset patch
# User David Soria Parra <davidsp at fb.com>
# Date 1413419457 25200
#      Wed Oct 15 17:30:57 2014 -0700
# Node ID 51b72a68f2fa4aa18ceb24f344f47612bf8f9d2e
# Parent  e62396e33ac6418fc0704e2d45c2afa0467c9672
histedit: add clear method to remove state

Encapsulate the unlinking histedit-state and use the vfs layer instead of
os.unlink.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -207,6 +207,9 @@
             self.topmost, self.replacements), fp)
         fp.close()
 
+    def clear(self):
+        self.repo.vfs.unlink('histedit-state')
+
 def commitfuncfor(repo, src):
     """Build a commit function for the replacement of <src>
 
@@ -586,7 +589,7 @@
             pass
         cleanupnode(ui, repo, 'created', tmpnodes)
         cleanupnode(ui, repo, 'temp', leafs)
-        os.unlink(os.path.join(repo.path, 'histedit-state'))
+        state.clear()
         return
     else:
         cmdutil.checkunfinished(repo)
@@ -683,7 +686,7 @@
             cleanupnode(ui, repo, 'replaced', mapping)
 
     cleanupnode(ui, repo, 'temp', tmpnodes)
-    os.unlink(os.path.join(repo.path, 'histedit-state'))
+    state.clear()
     if os.path.exists(repo.sjoin('undo')):
         os.unlink(repo.sjoin('undo'))
 


More information about the Mercurial-devel mailing list