configwizard: prompt to enable blackbox extension (bug 1279596); r?glob draft
authorGregory Szorc <gps@mozilla.com>
Fri, 10 Jun 2016 12:55:21 -0700
changeset 8537 e57a547d5c5200f5d56ee921442c4b58ba1416c5
parent 8536 105b25a2f2143d1c284f94ee57105de40a52b76f
child 8538 6579aee1a6b19e7f54171ae2ecf293f831e16d69
push id922
push userbmo:gps@mozilla.com
push dateFri, 10 Jun 2016 20:53:16 +0000
reviewersglob
bugs1279596
configwizard: prompt to enable blackbox extension (bug 1279596); r?glob The blackbox extension provides forensic logging of commands, their times, and other info useful for debugging performance problems and how people got to where they are. Countless times I've had to ask for its output in bug reports only to find out people don't have it enabled. So let's offer to enable it. MozReview-Commit-ID: BF3c8kNpbR5
hgext/configwizard/__init__.py
hgext/configwizard/tests/test-blackbox.t
--- a/hgext/configwizard/__init__.py
+++ b/hgext/configwizard/__init__.py
@@ -240,16 +240,17 @@ command = cmdutil.command(cmdtable)
 
 wizardsteps = {
     'hgversion',
     'username',
     'diff',
     'color',
     'historyediting',
     'fsmonitor',
+    'blackbox',
     'wip',
     'security',
     'firefoxtree',
     'codereview',
     'pushtotry',
     'multiplevct',
     'configchange',
     'permissions',
@@ -290,16 +291,21 @@ def configwizard(ui, repo, statedir=None
         _promptnativeextension(ui, cw, 'color', 'Enable color output to your terminal')
 
     if 'historyediting' in runsteps:
         _checkhistoryediting(ui, cw)
 
     if 'fsmonitor' in runsteps:
         _checkfsmonitor(ui, cw, hgversion)
 
+    if 'blackbox' in runsteps:
+        _promptnativeextension(ui, cw, 'blackbox',
+                               'Enable logging of commands to help diagnose bugs '
+                               'and performance problems')
+
     if 'wip' in runsteps:
         _checkwip(ui, cw)
 
     if 'security' in runsteps:
         _checksecurity(ui, cw, hgversion)
 
     if 'firefoxtree' in runsteps:
         _promptvctextension(ui, cw, 'firefoxtree', FIREFOXTREE_INFO)
new file mode 100644
--- /dev/null
+++ b/hgext/configwizard/tests/test-blackbox.t
@@ -0,0 +1,52 @@
+  $ . $TESTDIR/hgext/configwizard/tests/helpers.sh
+
+Rejecting blackbox doesn't enable it
+
+  $ hg --config ui.interactive=true --config configwizard.steps=blackbox,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>
+  Enable logging of commands to help diagnose bugs and performance problems (Yn)  n
+
+No prompt if blackbox already enabled
+
+  $ hg --config configwizard.steps=blackbox --config extensions.blackbox= 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>
+
+blackbox extension enabled if no input
+
+  $ hg --config configwizard.steps=blackbox,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>
+  Enable logging of commands to help diagnose bugs and performance problems (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]
+  +blackbox =
+  
+  Write changes to hgrc file (Yn)?  y
+
+  $ cat .hgrc
+  [extensions]
+  blackbox =