configwizard: prompt to install push-to-try (
bug 1277406); r?glob
Pretty straightforward. I'm tempted to consolidate this with the
"codereview" step. But I'll keep backwards compatibility for now.
MozReview-Commit-ID: H2GllAMTqC5
--- a/hgext/configwizard/__init__.py
+++ b/hgext/configwizard/__init__.py
@@ -159,31 +159,44 @@ Your existing Mercurial config uses a le
credentials. Bugzilla API Keys are the most secure and preferred method
for defining Bugzilla credentials. Bugzilla API Keys are also required
if you have enabled 2 Factor Authentication in Bugzilla.
For security reasons, the legacy credentials are being removed from the
config.
'''.lstrip()
+PUSHTOTRY_INFO = '''
+The push-to-try extension generates a temporary commit with a given
+try syntax and pushes it to the try server. The extension is intended
+to be used in concert with other tools generating try syntax so that
+they can push to try without depending on mq or other workarounds.
+
+(Relevant config option: extensions.push-to-try)
+
+Would you like to activate push-to-try (Yn)? $$ &Yes $$ &No
+'''.strip()
+
+
testedwith = '3.5 3.6 3.7 3.8'
buglink = 'https://bugzilla.mozilla.org/enter_bug.cgi?product=Developer%20Services&component=General'
cmdtable = {}
command = cmdutil.command(cmdtable)
wizardsteps = {
'hgversion',
'username',
'diff',
'color',
'historyediting',
'fsmonitor',
'firefoxtree',
'codereview',
+ 'pushtotry',
'configchange',
}
@command('configwizard', [
('s', 'statedir', '', _('directory to store state')),
], _('hg configwizard'), optionalrepo=True)
def configwizard(ui, repo, statedir=None, **opts):
"""Ensure your Mercurial configuration is up to date."""
@@ -223,16 +236,19 @@ def configwizard(ui, repo, statedir=None
_checkfsmonitor(ui, cw, hgversion)
if 'firefoxtree' in runsteps:
_promptvctextension(ui, cw, 'firefoxtree', FIREFOXTREE_INFO)
if 'codereview' in runsteps:
_checkcodereview(ui, cw)
+ if 'pushtotry' in runsteps:
+ _promptvctextension(ui, cw, 'push-to-try', PUSHTOTRY_INFO)
+
if 'configchange' in runsteps:
return _handleconfigchange(ui, cw)
return 0
def _checkhgversion(ui, hgversion):
if hgversion >= OLDEST_NON_LEGACY_VERSION:
--- a/hgext/configwizard/hgsetup/wizard.py
+++ b/hgext/configwizard/hgsetup/wizard.py
@@ -27,29 +27,16 @@ from .config import (
ParseException,
)
FINISHED = '''
Your Mercurial should now be properly configured and recommended extensions
should be up to date!
'''.strip()
-PUSHTOTRY_MINIMUM_VERSION = LooseVersion('3.5')
-
-PUSHTOTRY_INFO = '''
-The push-to-try extension generates a temporary commit with a given
-try syntax and pushes it to the try server. The extension is intended
-to be used in concert with other tools generating try syntax so that
-they can push to try without depending on mq or other workarounds.
-
-(Relevant config option: extensions.push-to-try)
-
-Would you like to activate push-to-try
-'''.strip()
-
WIP_INFO = '''
It is common to want a quick view of changesets that are in progress.
The ``hg wip`` command provides should a view.
Example Usage:
$ hg wip
@@ -111,19 +98,16 @@ class MercurialSetupWizard(object):
hg = get_hg_path()
config_path = config_file(config_paths)
self.updater.update_all()
hg_version = get_hg_version(hg)
- if hg_version >= PUSHTOTRY_MINIMUM_VERSION:
- self.prompt_external_extension(c, 'push-to-try', PUSHTOTRY_INFO)
-
if not c.have_wip():
if self._prompt_yn(WIP_INFO):
c.install_wip_alias()
# Look for and clean up old extensions.
for ext in {'bzexport', 'qimportbz', 'mqext'}:
path = os.path.join(self.ext_dir, ext)
if os.path.exists(path):
new file mode 100644
--- /dev/null
+++ b/hgext/configwizard/tests/test-push-to-try.t
@@ -0,0 +1,66 @@
+ $ . $TESTDIR/hgext/configwizard/tests/helpers.sh
+
+Rejecting pushtotry doesn't enable it
+
+ $ hg --config ui.interactive=true --config configwizard.steps=pushtotry,configchange configwizard << EOF
+ >
+ > n
+ > EOF
+ This wizard will guide you through configuring Mercurial for an optimal
+ experience contributing to Mozilla projects.
+
+ The wizard makes no changes without your permission.
+
+ To begin, press the enter/return key.
+ <RETURN>
+ The push-to-try extension generates a temporary commit with a given
+ try syntax and pushes it to the try server. The extension is intended
+ to be used in concert with other tools generating try syntax so that
+ they can push to try without depending on mq or other workarounds.
+
+ (Relevant config option: extensions.push-to-try)
+
+ Would you like to activate push-to-try (Yn)? n
+
+No prompt if extensions already enabled
+
+ $ hg --config configwizard.steps=pushtotry --config extensions.push-to-try=$TESTDIR/hgext/push-to-try configwizard
+ This wizard will guide you through configuring Mercurial for an optimal
+ experience contributing to Mozilla projects.
+
+ The wizard makes no changes without your permission.
+
+ To begin, press the enter/return key.
+ <RETURN>
+
+push-to-try enabled when requested
+
+ $ hg --config configwizard.steps=pushtotry,configchange configwizard
+ This wizard will guide you through configuring Mercurial for an optimal
+ experience contributing to Mozilla projects.
+
+ The wizard makes no changes without your permission.
+
+ To begin, press the enter/return key.
+ <RETURN>
+ The push-to-try extension generates a temporary commit with a given
+ try syntax and pushes it to the try server. The extension is intended
+ to be used in concert with other tools generating try syntax so that
+ they can push to try without depending on mq or other workarounds.
+
+ (Relevant config option: extensions.push-to-try)
+
+ Would you like to activate push-to-try (Yn)? y
+ Your config file needs updating.
+ Would you like to see a diff of the changes first (Yn)? y
+ --- hgrc.old
+ +++ hgrc.new
+ @@ -0,0 +1,2 @@
+ +[extensions]
+ +push-to-try = */hgext/push-to-try (glob)
+
+ Write changes to hgrc file (Yn)? y
+
+ $ cat .hgrc
+ [extensions]
+ push-to-try = */hgext/push-to-try (glob)