Configuring Mercurial to Use MozReview¶
If you already have a Firefox repository like
mozilla-central cloned, you
mach mercurial-setup from it and a guided wizard will walk
you through configuring Mercurial for optimal use on Mozilla projects.
Configuring Mercurial for MozReview is part of this wizard.
The wizard currently does not configure the
repository. See Configuring The Auto Review Repository for how to do
If you don’t have a Firefox repository, have no fear: just follow the instructions below.
Installing the Mercurial Extension¶
Interacting with MozReview from Mercurial requires a Mercurial extension to be installed and configured.
To install that extension, clone the
repository and activate the
hgext/reviewboard/client.py extension in
hgrc. For example:
$ hg clone https://hg.mozilla.org/hgcustom/version-control-tools ~/version-control-tools $ cat >> ~/.hgrc << EOF [extensions] reviewboard = ~/version-control-tools/hgext/reviewboard/client.py EOF
You likely already have an
[extensions] section in your Mercurial
hg config --edit --global (or
hg config -e
-g for short) to open your global configuration in an editor and
add the aforementioned extension under the
Configuring the Mercurial Extension¶
The Mercurial extension requires additional Mercurial configuration file options before it can be used.
You will need to define your BMO credentials in your Mercurial
configuration in order to authenticate with MozReview. These are placed
[bugzilla] section in your configuration file. Again,
hg config -e -g to open an editor and place something like the
following in your config file:
[bugzilla] ; Your Bugzilla username. This is an email address. username = firstname.lastname@example.org ; A Bugzilla API key apikey = ojQBGzhDmFYRFSX4xWNCSyOEsJKqisU0l0EJqXh6
You can generate or obtain an already-generated API Key from https://bugzilla.mozilla.org/userprefs.cgi?tab=apikey.
Logging into MozReview will create a Bugzilla API Key named
mozreview. This API Key has limited permissions and isn’t
suitable for general use. It is recommended to create an API
hg and define that in your Mercurial
MozReview currently uses your IRC nickname as an identifier when
creating reviews. You will need to define it in your Mercurial
configuration file under the
Use the following as a template:
[mozilla] ircnick = mynick
Configuring The Auto Review Repository¶
There is a special repository called the
autoreview repository that
will automatically see what you are pushing and redirect your push to
the appropriate code review repository. In other words, you don’t need
to configure a review path/remote for each clone: you simply define an
alias to the
autoreview repository in your global Mercurial
configuration file and it should just work.
hg config -e to edit your global Mercurial configuration
file, add an entry under the
[paths] section like so (be sure to use
the appropriate HTTP or SSH URL depending on what you have configured):
[paths] # For HTTP pushing review = https://reviewboard-hg.mozilla.org/autoreview # For SSH pushing review = ssh://reviewboard-hg.mozilla.org/autoreview
Now, you can
hg push review from any Mercurial repository and it
will go to the
autoreview repository and redirect to the appropriate
review repository automatically!