configwizard: prompt to configure the "review" path (
bug 1279596); r?glob
We recently removed the automagical "review" path from firefoxtree
(
bug 1275122). Let's make it explicit by having the config wizard
prompt for it.
This code isn't perfect: we won't prompt to add the "review" path
if we've already run the wizard once. The whole code review
setup workflow needs some love.
MozReview-Commit-ID: K5vEXyntybz
--- a/hgext/configwizard/__init__.py
+++ b/hgext/configwizard/__init__.py
@@ -663,17 +663,23 @@ def _checkcodereview(ui, cw):
ui.write(LEGACY_BUGZILLA_CREDENTIALS_DETECTED)
for c in ('password', 'userid', 'cookie'):
try:
del cw.c['bugzilla'][c]
except KeyError:
pass
- # TODO configure mozilla.ircnick and the "review" path
+ prompt = ('Configure the "review" path so you can `hg push review` commits to '
+ 'Mozilla for review (Yn)? $$ &Yes $$ &No')
+ if not ui.config('paths', 'review') and not ui.promptchoice(prompt):
+ cw.c.setdefault('paths', {})
+ cw.c['paths']['review'] = 'https://reviewboard-hg.mozilla.org/autoreview'
+
+ # TODO configure mozilla.ircnick
def _checkmultiplevct(ui, cw):
# References to multiple version-control-tools checkouts can confuse
# version-control-tools since various Mercurial extensions resolve
# dependencies via __file__. Files from different revisions could lead
# to unexpected environments and break things.
seenvct = set()
--- a/hgext/configwizard/tests/test-codereview.t
+++ b/hgext/configwizard/tests/test-codereview.t
@@ -53,40 +53,46 @@ reviewboard is enabled when requested
In order to communicate with Bugzilla and services (like MozReview) that
use Bugzilla for authentication, you'll need to supply an API Key.
The Bugzilla API Key is optional. However, if you don't supply one,
certain features may not work and/or you'll be prompted for one.
You should only need to configure a Bugzilla API Key once.
What is your Bugzilla email address? (optional)
+ Configure the "review" path so you can `hg push review` commits to Mozilla for review (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 @@
+ @@ -0,0 +1,4 @@
+[extensions]
+reviewboard = */hgext/reviewboard/client.py (glob)
+ +[paths]
+ +review = https://reviewboard-hg.mozilla.org/autoreview
Write changes to hgrc file (Yn)? y
$ cat .hgrc
[extensions]
reviewboard = */hgext/reviewboard/client.py (glob)
+ [paths]
+ review = https://reviewboard-hg.mozilla.org/autoreview
only bzexport can be enabled when requested
$ hg --config ui.interactive=true --config configwizard.steps=codereview,configchange configwizard << EOF
>
> y
> 3
> someone@example.com
> apikey
> y
> y
+ > y
> 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>
@@ -115,34 +121,39 @@ only bzexport can be enabled when reques
Bugzilla API Keys can only be obtained through the Bugzilla web interface.
Please perform the following steps:
1) Open https://bugzilla.mozilla.org/userprefs.cgi?tab=apikey
2) Generate a new API Key
3) Copy the generated key and paste it here
Please enter a Bugzilla API Key: (optional) apikey
+ Configure the "review" path so you can `hg push review` commits to Mozilla for review (Yn)? y
Your config file needs updating.
Would you like to see a diff of the changes first (Yn)? y
--- hgrc.old
+++ hgrc.new
- @@ -1,2 +1,6 @@
+ @@ -1,4 +1,8 @@
[extensions]
reviewboard = */hgext/reviewboard/client.py (glob)
+bzexport = */hgext/bzexport (glob)
+ [paths]
+ review = https://reviewboard-hg.mozilla.org/autoreview
+[bugzilla]
+username = someone@example.com
+apikey = apikey
Write changes to hgrc file (Yn)? y
$ cat .hgrc
[extensions]
reviewboard = */hgext/reviewboard/client.py (glob)
bzexport = */hgext/bzexport (glob)
+ [paths]
+ review = https://reviewboard-hg.mozilla.org/autoreview
[bugzilla]
username = someone@example.com
apikey = apikey
Legacy credentials are removed from config file
$ cat >> .hgrc << EOF
> cookie = bzcookie
@@ -151,16 +162,17 @@ Legacy credentials are removed from conf
$ hg --config ui.interactive=true --config bugzilla.cookie=cookie --config configwizard.steps=codereview,configchange configwizard << EOF
>
> y
> 3
> someone2@example.com
> apikey2
> y
> y
+ > y
> 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>
@@ -196,23 +208,24 @@ Legacy credentials are removed from conf
Please enter a Bugzilla API Key: (optional) apikey2
Your existing Mercurial config uses a legacy method for defining Bugzilla
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.
+ Configure the "review" path so you can `hg push review` commits to Mozilla for review (Yn)? y
Your config file needs updating.
Would you like to see a diff of the changes first (Yn)? y
--- hgrc.old
+++ hgrc.new
- @@ -2,6 +2,5 @@
- reviewboard = */hgext/reviewboard/client.py (glob)
- bzexport = */hgext/bzexport (glob)
+ @@ -4,6 +4,5 @@
+ [paths]
+ review = https://reviewboard-hg.mozilla.org/autoreview
[bugzilla]
-username = someone@example.com
-apikey = apikey
-cookie = bzcookie
+username = someone2@example.com
+apikey = apikey2
Write changes to hgrc file (Yn)? y