hgext/rebase.py
branchstable
changeset 19848 577f4c562d52
parent 19642 14ec82594f47
child 19849 e7fa36d2ad3a
--- a/hgext/rebase.py	Tue Oct 01 00:35:07 2013 +0900
+++ b/hgext/rebase.py	Tue Oct 01 00:35:07 2013 +0900
@@ -159,8 +159,19 @@
             if opts.get('tool', False):
                 ui.warn(_('tool option will be ignored\n'))
 
-            (originalwd, target, state, skipped, collapsef, keepf,
-                keepbranchesf, external, activebookmark) = restorestatus(repo)
+            try:
+                (originalwd, target, state, skipped, collapsef, keepf,
+                 keepbranchesf, external, activebookmark) = restorestatus(repo)
+            except error.RepoLookupError:
+                if abortf:
+                    clearstatus(repo)
+                    repo.ui.warn(_('rebase aborted (no revision is removed,'
+                                   ' only broken state is cleared)\n'))
+                    return 0
+                else:
+                    msg = _('cannot continue inconsistent rebase')
+                    hint = _('use "hg rebase --abort" to clear borken state')
+                    raise util.Abort(msg, hint=hint)
             if abortf:
                 return abort(repo, originalwd, target, state)
         else: