Bug 1039894 - Add bzpost and firefoxtree to mach mercurial-setup; r=smacleod
authorGregory Szorc <gps@mozilla.com>
Wed, 16 Jul 2014 19:18:49 -0700
changeset 216813 d84feb1c0de36cc836ebcd17939abdeeda038879
parent 216659 f77a9f8254279d66949179c8fa9ca4de580414eb
child 216814 a469473e6a4387932d8717c8cc4b91f102e3aab7
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1039894 - Add bzpost and firefoxtree to mach mercurial-setup; r=smacleod bzpost is an efficiency win for everyone. firefox tree is mostly useful for people doing head/bookmark-based development. Both extensions can yield massive productivity wins. They should be advertised. DONTBUILD (NPOTB) on a CLOSED TREE
--- a/tools/mercurial/hgsetup/wizard.py
+++ b/tools/mercurial/hgsetup/wizard.py
@@ -123,16 +123,49 @@ You do not have your Bugzilla credential
 Various extensions make use of your Bugzilla credentials to interface with
 Bugzilla to enrich your development experience.
 Bugzilla credentials are optional. If you do not provide them, associated
 functionality will not be enabled or you will be prompted for your
 Bugzilla credentials when they are needed.
+BZPOST_MINIMUM_VERSION = StrictVersion('3.0')
+The bzpost extension automatically records the URLs of pushed commits to
+referenced Bugzilla bugs after push.
+Would you like to activate bzpost
+The firefoxtree extension makes interacting with the multiple Firefox
+repositories easier:
+* Aliases for common trees are pre-defined. e.g. `hg pull central`
+* Pulling from known Firefox trees will create "remote refs" appearing as
+  tags. e.g. pulling from fx-team will produce a "fx-team" tag.
+* The `hg fxheads` command will list the heads of all pulled Firefox repos
+  for easy reference.
+* `hg push` will limit itself to pushing a single head when pushing to
+  Firefox repos.
+* A pre-push hook will prevent you from pushing multiple heads to known
+  Firefox repos. This acts quicker than a server-side hook.
+The firefoxtree extension is *strongly* recommended if you:
+a) aggregate multiple Firefox repositories into a single local repo
+b) perform head/bookmark-based development (as opposed to mq)
+Would you like to activate firefoxtree
 class MercurialSetupWizard(object):
     """Command-line wizard to help users configure Mercurial."""
     def __init__(self, state_dir):
         # We use normpath since Mercurial expects the hgrc to use native path
         # separators, but state_dir uses unix style paths even on Windows.
         self.state_dir = os.path.normpath(state_dir)
         self.ext_dir = os.path.join(self.state_dir, 'mercurial', 'extensions')
@@ -228,16 +261,22 @@ class MercurialSetupWizard(object):
                 p = os.path.join(self.vcs_tools_dir, 'hgext', 'reviewboard',
                 self.prompt_external_extension(c, 'reviewboard',
                     'Would you like to enable the reviewboard extension so '
                     'you can easily initiate code reviews against Mozilla '
+        if hg_version >= BZPOST_MINIMUM_VERSION:
+            self.prompt_external_extension(c, 'bzpost', BZPOST_INFO)
+        if hg_version >= FIREFOXTREE_MINIMUM_VERSION:
+            self.prompt_external_extension(c, 'firefoxtree', FIREFOXTREE_INFO)
         if 'mq' in c.extensions:
             self.prompt_external_extension(c, 'mqext', MQEXT_INFO,
                                            os.path.join(self.ext_dir, 'mqext'))
             if 'mqext' in c.extensions:
@@ -256,17 +295,17 @@ class MercurialSetupWizard(object):
             if not c.have_qnew_currentuser_default():
                 if self._prompt_yn('Would you like qnew to set patch author by '
                     print('Configured qnew to set patch author by default.')
-        if 'reviewboard' in c.extensions:
+        if 'reviewboard' in c.extensions or 'bzpost' in c.extensions:
             bzuser, bzpass = c.get_bugzilla_credentials()
             if not bzuser or not bzpass:
             if not bzuser:
                 bzuser = self._prompt('What is your Bugzilla email address?',
@@ -341,17 +380,21 @@ class MercurialSetupWizard(object):
             print('Activated %s extension.\n' % name)
     def prompt_external_extension(self, c, name, prompt_text, path=None):
         # Ask the user if the specified extension should be enabled. Defaults
         # to treating the extension as one in version-control-tools/hgext/
         # in a directory with the same name as the extension and thus also
         # flagging the version-control-tools repo as needing an update.
         if name not in c.extensions:
+            print(name)
+            print('=' * len(name))
+            print('')
             if not self._prompt_yn(prompt_text):
+                print('')
             print('Activated %s extension.\n' % name)
         if not path:
             path = os.path.join(self.vcs_tools_dir, 'hgext', name)
             self.update_vcs_tools = True
         c.activate_extension(name, path)
     def update_mercurial_repo(self, hg, url, dest, branch, msg):