pushrebase: skip adding --to option to push command if it already exists

Summary:
pushrebase extension adds the --to option to push command if the
remotenames extension is not loaded. This is not a robust enough check as other
extensions like infinitepush can also add the --to  option leading to duplicate
options. This commit addresses the same.

Test Plan: Ran all the tests.

Reviewers: rmcelroy, #mercurial, #sourcecontrol

Reviewed By: rmcelroy

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

Signature: 6691642:1515578521:9f783df23df9fa8d3291a6f050cc1d5b6e5dd2fa
This commit is contained in:
Saurabh Singh 2018-01-10 08:10:27 -08:00
parent 8159540c93
commit e803561cdc

View File

@ -89,10 +89,8 @@ def uisetup(ui):
def extsetup(ui):
entry = wrapcommand(commands.table, 'push', _push)
try:
# Don't add the 'to' arg if it already exists
extensions.find('remotenames')
except KeyError:
if not any(a for a in entry[1] if a[1] == 'to'):
entry[1].append(('', 'to', '', _('server revision to rebase onto')))
partorder = exchange.b2partsgenorder