comparison hgext/rebase.py @ 19848:577f4c562d52 stable

rebase: catch RepoLookupError at restoring rebase state for abort/continue Before this patch, "rebase --abort"/"--continue" may fail, when rebase state is inconsistent: for example, the root of rebase destination revisions recorded in rebase state file is already stripped manually. Mercurial earlier than 2.7 allows users to do anything other than starting new rebase, even though current rebase is not finished or aborted yet. So, such inconsistent rebase states may be left and forgotten in repositories. This patch catches RepoLookupError at restoring rebase state for abort/continue, and treat such state as "broken".
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 01 Oct 2013 00:35:07 +0900
parents 14ec82594f47
children e7fa36d2ad3a
comparison
equal deleted inserted replaced
19847:45c3086880c7 19848:577f4c562d52
157 raise util.Abort( 157 raise util.Abort(
158 _('abort and continue do not allow specifying revisions')) 158 _('abort and continue do not allow specifying revisions'))
159 if opts.get('tool', False): 159 if opts.get('tool', False):
160 ui.warn(_('tool option will be ignored\n')) 160 ui.warn(_('tool option will be ignored\n'))
161 161
162 (originalwd, target, state, skipped, collapsef, keepf, 162 try:
163 keepbranchesf, external, activebookmark) = restorestatus(repo) 163 (originalwd, target, state, skipped, collapsef, keepf,
164 keepbranchesf, external, activebookmark) = restorestatus(repo)
165 except error.RepoLookupError:
166 if abortf:
167 clearstatus(repo)
168 repo.ui.warn(_('rebase aborted (no revision is removed,'
169 ' only broken state is cleared)\n'))
170 return 0
171 else:
172 msg = _('cannot continue inconsistent rebase')
173 hint = _('use "hg rebase --abort" to clear borken state')
174 raise util.Abort(msg, hint=hint)
164 if abortf: 175 if abortf:
165 return abort(repo, originalwd, target, state) 176 return abort(repo, originalwd, target, state)
166 else: 177 else:
167 if srcf and basef: 178 if srcf and basef:
168 raise util.Abort(_('cannot specify both a ' 179 raise util.Abort(_('cannot specify both a '