Patchwork [7,of,8] rebase: refactoring to make restorestatus throw only error.Abort

login
register
mail settings
Submitter Christian Delahousse
Date Oct. 16, 2015, 2:33 a.m.
Message ID <d0d588cb2c8f490b2256.1444962816@dev4253.prn1.facebook.com>
Download mbox | patch
Permalink /patch/11139/
State Changes Requested
Headers show

Comments

Christian Delahousse - Oct. 16, 2015, 2:33 a.m.
# HG changeset patch
# User Christian Delahousse <cdelahousse@fb.com>
# Date 1444952841 25200
#      Thu Oct 15 16:47:21 2015 -0700
# Node ID d0d588cb2c8f490b2256e99b0df97f8b90bfc6e2
# Parent  e717eac5fb915f0d7c31db9559dd866a57b0f0c0
rebase: refactoring to make restorestatus throw only error.Abort

Have restorestatus throw only Abort exception so you don't need to know that it
also throws RepoLookupErrors. This has the slight behaviour change that calling
summary with a corrupt shelvestate file outputs more helpful directions.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -259,7 +259,7 @@ 
 
             try:
                 result = restorestatus(repo)
-            except error.RepoLookupError:
+            except error.Abort:
                 if abortf:
                     clearstatus(repo)
                     repo.ui.warn(_('rebase aborted (no revision is removed,'
@@ -893,6 +893,8 @@ 
             raise
         # No file, so no rebase in progress
         return None
+    except error.RepoLookupError:
+        raise error.Abort(_('rev not found'))
 
     if keepbranches is None:
         raise error.Abort(_('.hg/rebasestate is incomplete'))
@@ -1215,7 +1217,7 @@ 
         if not result:
             return
         state = result[2]
-    except error.RepoLookupError:
+    except error.Abort:
         # i18n: column positioning for "hg summary"
         msg = _('rebase: (use "hg rebase --abort" to clear broken state)\n')
         ui.write(msg)
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -19,8 +19,7 @@ 
   branch: default
   commit: (clean)
   update: (current)
-  abort: .hg/rebasestate is incomplete
-  [255]
+  rebase: (use "hg rebase --abort" to clear broken state)
   $ rm .hg/rebasestate
 
   $ echo c1 > common