From patchwork Sun Jul 1 12:37:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D3865: histedit: use self.stateobj to check whether interrupted histedit exists From: phabricator X-Patchwork-Id: 32547 Message-Id: <0680c42d4e4bf7e3f97f1438ce5059f4@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Sun, 1 Jul 2018 12:37:41 +0000 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 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