##// END OF EJS Templates
rebase: catch RepoLookupError at restoring rebase state for abort/continue...
FUJIWARA Katsunori -
r19848:577f4c56 stable
parent child Browse files
Show More
@@ -159,8 +159,19 b' def rebase(ui, repo, **opts):'
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 try:
162 (originalwd, target, state, skipped, collapsef, keepf,
163 (originalwd, target, state, skipped, collapsef, keepf,
163 keepbranchesf, external, activebookmark) = restorestatus(repo)
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:
@@ -75,6 +75,29 b' Abort:'
75 |
75 |
76 o 0:draft 'C1'
76 o 0:draft 'C1'
77
77
78 Test safety for inconsistent rebase state, which may be created (and
79 forgotten) by Mercurial earlier than 2.7. This emulates Mercurial
80 earlier than 2.7 by renaming ".hg/rebasestate" temporarily.
81
82 $ hg rebase -s 3 -d 2
83 merging common
84 warning: conflicts during merge.
85 merging common incomplete! (edit conflicts, then use 'hg resolve --mark')
86 unresolved conflicts (see hg resolve, then hg rebase --continue)
87 [1]
88
89 $ mv .hg/rebasestate .hg/rebasestate.back
90 $ hg update --quiet --clean 2
91 $ hg --config extensions.mq= strip --quiet "destination()"
92 $ mv .hg/rebasestate.back .hg/rebasestate
93
94 $ hg rebase --continue
95 abort: cannot continue inconsistent rebase
96 (use "hg rebase --abort" to clear borken state)
97 [255]
98 $ hg rebase --abort
99 rebase aborted (no revision is removed, only broken state is cleared)
100
78 $ cd ..
101 $ cd ..
79
102
80
103
General Comments 0
You need to be logged in to leave comments. Login now