Patchwork D3865: histedit: use self.stateobj to check whether interrupted histedit exists

login
register
mail settings
Submitter phabricator
Date July 1, 2018, 12:37 p.m.
Message ID <0680c42d4e4bf7e3f97f1438ce5059f4@localhost.localdomain>
Download mbox | patch
Permalink /patch/32547/
State Not Applicable
Headers show

Comments

phabricator - July 1, 2018, 12:37 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG03e7ec8180f0: histedit: use self.stateobj to check whether interrupted histedit exists (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3865?vs=9377&id=9391

REVISION DETAIL
  https://phab.mercurial-scm.org/D3865

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS




To: pulkit, durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -183,7 +183,6 @@ 
 
 from __future__ import absolute_import
 
-import errno
 import os
 
 from mercurial.i18n import _
@@ -313,14 +312,10 @@ 
 
     def read(self):
         """Load histedit state from disk and set fields appropriately."""
-        try:
-            state = self.repo.vfs.read('histedit-state')
-        except IOError as err:
-            if err.errno != errno.ENOENT:
-                raise
+        if not self.stateobj.exists():
             cmdutil.wrongtooltocontinue(self.repo, _('histedit'))
 
-        data = self._read(state)
+        data = self._read()
 
         self.parentctxnode = data['parentctxnode']
         actions = parserules(data['rules'], self)
@@ -330,7 +325,8 @@ 
         self.replacements = data['replacements']
         self.backupfile = data['backupfile']
 
-    def _read(self, fp):
+    def _read(self):
+        fp = self.repo.vfs.read('histedit-state')
         if fp.startswith('v1\n'):
             data = self._load()
             parentctxnode, rules, keep, topmost, replacements, backupfile = data