[PATCH 4 of 8] rebase: move no rebasestate file check out of restorestatus
Christian Delahousse
cdelahousse at fb.com
Thu Oct 15 21:33:33 CDT 2015
# HG changeset patch
# User Christian Delahousse <cdelahousse at fb.com>
# Date 1444948508 25200
# Thu Oct 15 15:35:08 2015 -0700
# Node ID ef6cee42f6058ae824978db8559920dd6c1e3fb2
# Parent d8c393e7c3bec8f2ba0ea286d121c05a999e7ade
rebase: move no rebasestate file check out of restorestatus
Throwing exceptions when no statefile exists is not very exceptional. I change
restorestatus so it returns None instead of throwing an exception. This also
allows the error handling (no rebase running with --continue) to be moved up one
level of abstraction with the majority of the other error handling code.
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -258,8 +258,12 @@
ui.warn(_('tool option will be ignored\n'))
try:
+ result = restorestatus(repo)
+ if not result:
+ raise error.Abort(_('no rebase in progress'))
+
(originalwd, target, state, skipped, collapsef, keepf,
- keepbranchesf, external, activebookmark) = restorestatus(repo)
+ keepbranchesf, external, activebookmark) = result
except error.RepoLookupError:
if abortf:
clearstatus(repo)
@@ -885,7 +889,8 @@
except IOError as err:
if err.errno != errno.ENOENT:
raise
- raise error.Abort(_('no rebase in progress'))
+ # No file, so no rebase in progress
+ return None
if keepbranches is None:
raise error.Abort(_('.hg/rebasestate is incomplete'))
More information about the Mercurial-devel
mailing list