2017-06-05 18:54:52 +02:00
|
|
|
|
Get Zulip notifications when you `hg push`!
|
|
|
|
|
|
2017-06-22 04:22:41 +02:00
|
|
|
|
{!create-stream.md!}
|
2017-06-05 18:54:52 +02:00
|
|
|
|
|
|
|
|
|
Next, on your {{ settings_html|safe }}, create a Mercurial bot.
|
|
|
|
|
|
|
|
|
|
Then:
|
|
|
|
|
|
2017-06-22 04:22:41 +02:00
|
|
|
|
1. {!download-python-bindings.md!}
|
2017-06-05 18:54:52 +02:00
|
|
|
|
|
2021-09-01 00:01:37 +02:00
|
|
|
|
2. Edit the `hg/.hgrc` configuration file for this default Mercurial
|
2017-06-05 18:54:52 +02:00
|
|
|
|
repository and add the following sections, using the credentials for
|
|
|
|
|
your Mercurial bot and setting the appropriate path to the integration
|
|
|
|
|
hook if it installs in a different location on this system:
|
|
|
|
|
|
|
|
|
|
[hooks]
|
2018-05-28 14:55:48 +02:00
|
|
|
|
changegroup = python:zulip_changegroup.hook
|
2017-06-05 18:54:52 +02:00
|
|
|
|
|
|
|
|
|
[zulip]
|
|
|
|
|
email = "hg-bot@example.com"
|
|
|
|
|
api_key = "0123456789abcdefg"
|
|
|
|
|
stream = "commits"
|
2017-10-30 22:04:15 +01:00
|
|
|
|
site = {{ api_url }}
|
2017-06-05 18:54:52 +02:00
|
|
|
|
|
2018-05-28 14:55:48 +02:00
|
|
|
|
3. Add the directory where the `zulip_changegroup.py` script was
|
|
|
|
|
installed to the environment variable `PYTHONPATH`. For example, if
|
|
|
|
|
you installed the Zulip Python bindings at the system level, it'd be:
|
|
|
|
|
|
|
|
|
|
export PYTHONPATH=/usr/local/share/zulip/integrations/hg:$PYTHONPATH
|
|
|
|
|
|
2017-06-05 18:54:52 +02:00
|
|
|
|
That’s all it takes for the basic setup! On the next `hg push`, you’ll
|
|
|
|
|
get a Zulip update for the changeset.
|
|
|
|
|
|
|
|
|
|
### More configuration options
|
|
|
|
|
|
|
|
|
|
The Mercurial integration also supports:
|
|
|
|
|
|
|
|
|
|
- linking to changelog and revision URLs for your repository’s web UI
|
|
|
|
|
- branch whitelists and blacklists
|
|
|
|
|
|
|
|
|
|
#### Web repository links
|
|
|
|
|
|
2017-06-22 04:22:41 +02:00
|
|
|
|
If you’ve set up your repository to be [browsable via the web][1],
|
2017-06-05 18:54:52 +02:00
|
|
|
|
add a `web_url` configuration option to the `zulip` section of your
|
2021-09-01 00:01:37 +02:00
|
|
|
|
default `.hg/hgrc` to get changelog and revision links in your Zulip
|
2017-06-05 18:54:52 +02:00
|
|
|
|
notifications:
|
|
|
|
|
|
|
|
|
|
[zulip]
|
|
|
|
|
email = "hg-bot@example.com"
|
|
|
|
|
api_key = "0123456789abcdefg"
|
|
|
|
|
stream = "commits"
|
|
|
|
|
web_url = "http://hg.example.com:8000/"
|
2017-10-30 22:04:15 +01:00
|
|
|
|
site = {{ api_url }}
|
2017-06-05 18:54:52 +02:00
|
|
|
|
|
2020-03-27 01:32:21 +01:00
|
|
|
|
[1]: https://www.mercurial-scm.org/wiki/QuickStart#Network_support
|
2017-06-22 04:22:41 +02:00
|
|
|
|
|
2017-06-05 18:54:52 +02:00
|
|
|
|
#### Branch whitelists and blacklists
|
|
|
|
|
|
|
|
|
|
By default, this integration will send Zulip notifications for
|
|
|
|
|
changegroup events for all branches. If you’d prefer to only receive
|
|
|
|
|
Zulip notifications for specified branches, add a `branches`
|
2021-09-01 00:01:37 +02:00
|
|
|
|
configuration option to the `zulip` section of your default `.hg/hgrc`,
|
2017-06-05 18:54:52 +02:00
|
|
|
|
containing a comma-separated list of the branches that should produce
|
|
|
|
|
notifications:
|
|
|
|
|
|
|
|
|
|
[zulip]
|
|
|
|
|
email = "hg-bot@example.com"
|
|
|
|
|
api_key = "0123456789abcdefg"
|
|
|
|
|
stream = "commits"
|
2021-09-01 00:01:37 +02:00
|
|
|
|
branches = "prod,default"
|
2017-06-05 18:54:52 +02:00
|
|
|
|
|
|
|
|
|
You can also exclude branches that you don’t want to cause
|
|
|
|
|
notifications. To do so, add an `ignore_branches` configuration option
|
2021-09-01 00:01:37 +02:00
|
|
|
|
to the `zulip` section of your default `.hg/hgrc`, containing a
|
2017-06-05 18:54:52 +02:00
|
|
|
|
comma-separated list of the branches that should be ignored:
|
|
|
|
|
|
|
|
|
|
[zulip]
|
|
|
|
|
email = "hg-bot@example.com"
|
|
|
|
|
api_key = "0123456789abcdefg"
|
|
|
|
|
stream = "commits"
|
|
|
|
|
ignore_branches = "noisy,even-more-noisy"
|
|
|
|
|
|
|
|
|
|
When team members push new changesets with `hg push`, you’ll get a
|
|
|
|
|
Zulip notification.
|
|
|
|
|
|
2017-06-22 04:22:41 +02:00
|
|
|
|
{!congrats.md!}
|
2017-06-05 18:54:52 +02:00
|
|
|
|
|
2020-08-05 11:50:17 +02:00
|
|
|
|
![Mercurial bot message](/static/images/integrations/hg/001.png)
|