From 489a7d17849f21e51adcac8aa6349fb7e9bd6860 Mon Sep 17 00:00:00 2001 From: Tomasz Kolek Date: Wed, 5 Apr 2017 07:35:34 +0200 Subject: [PATCH] integrations doc: Move mercurial doc to separate file. --- templates/zerver/integrations/index.html | 103 ------------------ templates/zerver/integrations/mercurial.html | 105 +++++++++++++++++++ tools/check-templates | 2 + zerver/lib/integrations.py | 7 +- 4 files changed, 113 insertions(+), 104 deletions(-) create mode 100644 templates/zerver/integrations/mercurial.html diff --git a/templates/zerver/integrations/index.html b/templates/zerver/integrations/index.html index 1fa596206e..262d04d536 100644 --- a/templates/zerver/integrations/index.html +++ b/templates/zerver/integrations/index.html @@ -116,109 +116,6 @@ {% include 'zerver/integrations/email.html' %} {% endif %} -
- -

Get Zulip notifications when you hg push!

- -

First, create the stream you'd like to use for Mercurial notifications, - and subscribe all interested parties to this stream. We recommend the - name commits.

- -

Next, on your {{ settings_html|safe }}, create a Mercurial bot.

- -

Then:

-
    -
  1. -

    Download and install our Python bindings on the - server where the master Mercurial repository lives.

    -
  2. -
  3. -

    Edit the hg/.hgrc configuration file for this master - Mercurial 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]
    -changegroup = python:/usr/local/share/zulip/integrations/hg/zulip-changegroup.py:hook
    -
    -[zulip]
    -email = "hg-bot@example.com"
    -api_key = "0123456789abcdefg"
    -stream = "commits"
    -{% if api_site_required %}site = {{ external_api_uri_subdomain }}{% endif %}
    -
  4. -
- -

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:

- - -

Web repository links

- -

If you've set up your repository to - be browsable - via the web, add a web_url configuration option to - the zulip section of your master .hg/hgrc to get - changelog and revision links in your Zulip notifications:

- -
[zulip]
-email = "hg-bot@example.com"
-api_key = "0123456789abcdefg"
-stream = "commits"
-web_url = "http://hg.example.com:8000/"
-{% if api_site_required %}site = {{ external_api_uri_subdomain }}{% endif %}
- - -

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 - configuration option to the zulip section of your - master .hg/hgrc, containing a comma-separated list of the - branches that should produce notifications:

- -
[zulip]
-email = "hg-bot@example.com"
-api_key = "0123456789abcdefg"
-stream = "commits"
-branches = "prod,master"
- -

You can also exclude branches that you don't want to cause - notifications. To do so, add an ignore_branches configuration - option to the zulip section of your - master .hg/hgrc, containing a 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"
- -

Congratulations! You're done!
When team members push new - changesets with hg push, you'll get a Zulip notification that - looks like this:

- - - -

- Logos are trademarks of their respective owners. - None of the integrations on this page are created by, - affiliated with, or supported by the companies - represented by the logos. -

-
-
diff --git a/templates/zerver/integrations/mercurial.html b/templates/zerver/integrations/mercurial.html new file mode 100644 index 0000000000..0b5db802b7 --- /dev/null +++ b/templates/zerver/integrations/mercurial.html @@ -0,0 +1,105 @@ +

Get Zulip notifications when you hg push!

+ +

+ First, create the stream you'd like to use for Mercurial notifications, + and subscribe all interested parties to this stream. We recommend the + name commits. +

+ +

Next, on your {{ settings_html|safe }}, create a Mercurial bot.

+ +

Then:

+
    +
  1. +

    Download and install our Python bindings on the + server where the master Mercurial repository lives.

    +
  2. +
  3. +

    + Edit the hg/.hgrc configuration file for this master + Mercurial 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]
    +changegroup = python:/usr/local/share/zulip/integrations/hg/zulip-changegroup.py:hook
    +
    +[zulip]
    +email = "hg-bot@example.com"
    +api_key = "0123456789abcdefg"
    +stream = "commits"
    +{% if api_site_required %}site = {{ external_api_uri_subdomain }}{% endif %}
    +
  4. +
+ +

+ 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:

+ + +

Web repository links

+ +

+ If you've set up your repository to be + browsable via the web, + add a web_url configuration option to + the zulip section of your master .hg/hgrc to get + changelog and revision links in your Zulip notifications: +

+ +
[zulip]
+email = "hg-bot@example.com"
+api_key = "0123456789abcdefg"
+stream = "commits"
+web_url = "http://hg.example.com:8000/"
+{% if api_site_required %}site = {{ external_api_uri_subdomain }}{% endif %}
+ + +

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 + configuration option to the zulip section of your + master .hg/hgrc, containing a comma-separated list of the + branches that should produce notifications: +

+ +
[zulip]
+email = "hg-bot@example.com"
+api_key = "0123456789abcdefg"
+stream = "commits"
+branches = "prod,master"
+ +

You can also exclude branches that you don't want to cause + notifications. To do so, add an ignore_branches configuration + option to the zulip section of your + master .hg/hgrc, containing a 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"
+ +

+ Congratulations! You're done!
When team members push new + changesets with hg push, you'll get a Zulip notification that + looks like this: +

+ + diff --git a/tools/check-templates b/tools/check-templates index f8c9079779..a147e05e61 100755 --- a/tools/check-templates +++ b/tools/check-templates @@ -130,6 +130,7 @@ def check_html_templates(templates, all_dups): 'templates/zerver/integrations/capistrano.html', 'templates/zerver/integrations/git.html', 'templates/zerver/integrations/jira-plugin.html', + 'templates/zerver/integrations/mercurial.html', ] validate(fn=fn, check_indent=(fn not in bad_files)) @@ -188,6 +189,7 @@ def check_html_templates(templates, all_dups): 'templates/zerver/integrations/git.html', 'templates/zerver/integrations/google-calendar.html', 'templates/zerver/integrations/jira-plugin.html', + 'templates/zerver/integrations/mercurial.html', ] # TODO: Clean these files for fn in templates: diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py index 3e4481eef4..e50b6bd3a5 100644 --- a/zerver/lib/integrations.py +++ b/zerver/lib/integrations.py @@ -209,7 +209,12 @@ INTEGRATIONS = { display_name='JIRA', doc='zerver/integrations/jira-plugin.html' ), - 'mercurial': Integration('mercurial', 'mercurial', display_name='Mercurial (hg)'), + 'mercurial': Integration( + 'mercurial', + 'mercurial', + display_name='Mercurial (hg)', + doc='zerver/integrations/mercurial.html' + ), 'nagios': Integration('nagios', 'nagios'), 'openshift': Integration('openshift', 'openshift', display_name='OpenShift'), 'perforce': Integration('perforce', 'perforce'),