fbamend: silently drop --dest in restack instead of aborting

Summary:
The remotenames extension automatically adds a --dest option to `hg rebase`, which causes
restack to abort. Instead, we should just drop the 'dest' key and proceed.

Test Plan: Attempt to use `hg rebase --restack` in fbsource when the current bookmark is tracking a remote bookmark.

Reviewers: #mercurial, durham, rmcelroy

Reviewed By: rmcelroy

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4399846

Tasks: 15422257

Signature: t1:4399846:1484084585:4a6ec907032e7d8b1388980870b6d72cb560829f
This commit is contained in:
Arun Kulshreshtha 2017-01-10 13:53:43 -08:00
parent 7221a13080
commit db1e6df35f
2 changed files with 5 additions and 5 deletions

View File

@ -711,10 +711,13 @@ def wraprebase(orig, ui, repo, **opts):
replacement for) the `hg evolve --all` command.
"""
if opts['restack']:
# We can't abort if --dest is passed because some extensions
# (namely remotenames) will automatically add this flag.
# So just silently drop it instead.
opts.pop('dest', None)
if opts['rev']:
raise error.Abort(_("cannot use both --rev and --restack"))
if opts['dest']:
raise error.Abort(_("cannot use both --dest and --restack"))
if opts['source']:
raise error.Abort(_("cannot use both --source and --restack"))
if opts['base']:

View File

@ -40,9 +40,6 @@ Test unsupported flags:
$ hg rebase --restack --rev .
abort: cannot use both --rev and --restack
[255]
$ hg rebase --restack --dest .
abort: cannot use both --dest and --restack
[255]
$ hg rebase --restack --source .
abort: cannot use both --source and --restack
[255]