# HG changeset patch # User Marcin Kuzminski # Date 2018-02-28 12:39:12 # Node ID b00c6b3ebbb815710532bb2c0c32c4d4fa895236 # Parent f61fee8900a70f0432aff9838dabbc57f8f9f17a slack: added a case for SVN commits to trunk diff --git a/rhodecode/integrations/types/slack.py b/rhodecode/integrations/types/slack.py --- a/rhodecode/integrations/types/slack.py +++ b/rhodecode/integrations/types/slack.py @@ -267,12 +267,20 @@ class SlackIntegrationType(IntegrationTy title = render_with_traceback(template, data=data) repo_push_template = Template(textwrap.dedent(r''' - %for branch, branch_commits in branches_commits.items(): - ${len(branch_commits['commits'])} ${'commit' if len(branch_commits['commits']) == 1 else 'commits'} on branch: <${branch_commits['branch']['url']}|${branch_commits['branch']['name']}> - %for commit in branch_commits['commits']: + <% + def branch_text(branch): + if branch: + return 'on branch: <{}|{}>'.format(branch_commits['branch']['url'], branch_commits['branch']['name']) + else: + ## case for SVN no branch push... + return 'to trunk' + %> \ + % for branch, branch_commits in branches_commits.items(): + ${len(branch_commits['commits'])} ${'commit' if len(branch_commits['commits']) == 1 else 'commits'} ${branch_text(branch)} + % for commit in branch_commits['commits']: `<${commit['url']}|${commit['short_id']}>` - ${commit['message_html']|html_to_slack_links} - %endfor - %endfor + % endfor + % endfor ''')) text = render_with_traceback(