Patchwork D3875: rebase: use staeobj to check whether interrupted rebase exists

login
register
mail settings
Submitter phabricator
Date July 1, 2018, 8:33 p.m.
Message ID <differential-rev-PHID-DREV-4jb7tzrx6aojcsggnid7-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32555/
State Superseded
Headers show

Comments

phabricator - July 1, 2018, 8:33 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This cleans up the code a bit.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




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

Patch

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