fbamend: abort if preamend bookmark points to the current commit

Differential Revision: https://phabricator.intern.facebook.com/D3436696
This commit is contained in:
Kostia Balytskyi 2016-06-17 05:25:32 -07:00
parent f7d38f2065
commit 1d18a2690a
2 changed files with 25 additions and 2 deletions

View File

@ -305,11 +305,17 @@ def fixupamend(ui, repo):
raise error.Abort(_('no bookmark %s') % preamendname,
hint=_('check if your bookmark is active'))
ui.status(_("rebasing the children of %s\n") % (preamendname))
old = repo[preamendname]
if old == current:
hint = _('please examine smartlog and rebase your commits manually')
err = _('cannot automatically determine what to rebase '
'because bookmark "%s" points to the current commit') % \
preamendname
raise error.Abort(err, hint=hint)
oldbookmarks = old.bookmarks()
ui.status(_("rebasing the children of %s\n") % (preamendname))
active = bmactive(repo)
opts = {
'rev' : [str(c.rev()) for c in old.descendants()],

View File

@ -651,4 +651,21 @@ Check whether unamend works with dirty working directory
A c
A d
R b
$ cd ..
Check whether fbamend warns people if preamend bookmark is the same as an active
bookmark
$ hg init messedpreamed && cd messedpreamed
$ echo root > root && hg ci -Am root
adding root
$ hg book -r . activebook
$ hg book -r . activebook.preamend
$ hg up activebook
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
(activating bookmark activebook)
$ hg amend --fixup
abort: cannot automatically determine what to rebase because bookmark "activebook.preamend" points to the current commit
(please examine smartlog and rebase your commits manually)
[255]