[PATCH 5 of 8] rebase: move check for "rebase in progress"

Christian Delahousse cdelahousse at fb.com
Thu Oct 15 21:33:34 CDT 2015


# HG changeset patch
# User Christian Delahousse <cdelahousse at fb.com>
# Date 1444953637 25200
#      Thu Oct 15 17:00:37 2015 -0700
# Node ID 73fa24b0b32b6b65f3c3c71d066f54e149b69b87
# Parent  ef6cee42f6058ae824978db8559920dd6c1e3fb2
rebase: move check for "rebase in progress"

Moved the code that checks for no rebase in progress out of the try catch to
make the block's scope smaller. Will help in for next patch in series

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -259,11 +259,6 @@
 
             try:
                 result = restorestatus(repo)
-                if not result:
-                    raise error.Abort(_('no rebase in progress'))
-
-                (originalwd, target, state, skipped, collapsef, keepf,
-                 keepbranchesf, external, activebookmark) = result
             except error.RepoLookupError:
                 if abortf:
                     clearstatus(repo)
@@ -274,6 +269,13 @@
                     msg = _('cannot continue inconsistent rebase')
                     hint = _('use "hg rebase --abort" to clear broken state')
                     raise error.Abort(msg, hint=hint)
+
+            if not result:
+                raise error.Abort(_('no rebase in progress'))
+
+            (originalwd, target, state, skipped, collapsef, keepf,
+                keepbranchesf, external, activebookmark) = result
+
             if abortf:
                 return abort(repo, originalwd, target, state,
                              activebookmark=activebookmark)


More information about the Mercurial-devel mailing list