From 9dde906115ab02b5998e75830977a5462f47a1e7 Mon Sep 17 00:00:00 2001 From: Eeshan Garg Date: Wed, 21 Jun 2017 22:38:11 -0230 Subject: [PATCH] integrations/git: Use macros and improve Markdown. --- templates/zerver/integrations/git.md | 24 ++++++------------------ zerver/lib/integrations.py | 6 +++++- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/templates/zerver/integrations/git.md b/templates/zerver/integrations/git.md index b85441196e..c7c43f610c 100644 --- a/templates/zerver/integrations/git.md +++ b/templates/zerver/integrations/git.md @@ -1,38 +1,26 @@ -{! download-python-bindings.md !} +{!download-python-bindings.md!} -Next, create the stream you’d like to use for Git notifications, and -subscribe all interested parties to this stream. The integration will -use the default stream `commits` if no stream is supplied in the hook; -you still need to create the stream even if you are using this -default. +{!create-stream.md!} -Next, open `integrations/git/zulip_git_config.py` in your favorite -editor, and change the following lines to specify the email address -and API key for your Git bot: - -``` -ZULIP_USER = "git-bot@example.com" -ZULIP_API_KEY = "0123456789abcdef0123456789abcdef" -{% if api_site_required %}ZULIP_SITE = "{{ external_api_uri_subdomain }}"{% endif %} -``` +{!change-zulip-config-file.md!} You can also specify which pushes will result in notifications and to what stream the notifications will be sent by modifying the `commit_notice_destination` function in `zulip_git_config.py`. By default, pushes to the `master` and `test-post-receive` branches will -result in a notification to stream `commits`. +result in a notification to the stream `commits`. Save `integrations/git/zulip_git_config.py` to the `.git/hooks` directory of your git repository. -Symlink `/usr/local/share/zulip/integrations/git/post-receive` into +Symlink `/usr/local/share/zulip/integrations/git/post-receive` to the `.git/hooks` directory of your git repository. Whenever you make a push to the `master` branch of your git repository (or whatever you configured above), the Zulip git plugin will send an automated notification. -{! congrats.md !} +{!congrats.md!} ![](/static/images/integrations/git/001.png) diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py index 970379dc6f..a074f01579 100644 --- a/zerver/lib/integrations.py +++ b/zerver/lib/integrations.py @@ -253,7 +253,11 @@ INTEGRATIONS = { 'capistrano': Integration('capistrano', 'capistrano', display_name='Capistrano', doc='zerver/integrations/capistrano.md'), 'codebase': Integration('codebase', 'codebase', doc='zerver/integrations/codebase.md'), 'email': EmailIntegration('email', 'email', doc='zerver/integrations/email.md'), - 'git': Integration('git', 'git', doc='zerver/integrations/git.md'), + 'git': Integration( + 'git', 'git', + doc='zerver/integrations/git.md', + stream_name='commits', + ), 'google-calendar': Integration( 'google-calendar', 'google-calendar',