changeset 38517:4df9cef86740

rebase: use staeobj to check whether interrupted rebase exists This cleans up the code a bit. Differential Revision: https://phab.mercurial-scm.org/D3875
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 01 Jul 2018 00:52:25 +0530
parents 7c853edcf4ed
children cf24f678adda
files hgext/rebase.py
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sun Jul 01 00:46:59 2018 +0530
+++ b/hgext/rebase.py	Sun Jul 01 00:52:25 2018 +0530
@@ -250,7 +250,9 @@
         state = {}
         destmap = {}
 
-        try:
+        if not self.stateobj.exists():
+            cmdutil.wrongtooltocontinue(repo, _('rebase'))
+        else:
             f = repo.vfs("rebasestate")
             for i, l in enumerate(f.read().splitlines()):
                 if i == 0:
@@ -290,11 +292,6 @@
                     else:
                         state[oldrev] = repo[newrev].rev()
 
-        except IOError as err:
-            if err.errno != errno.ENOENT:
-                raise
-            cmdutil.wrongtooltocontinue(repo, _('rebase'))
-
         if data['keepbranches'] is None:
             raise error.Abort(_('.hg/rebasestate is incomplete'))