mirror of https://github.com/zulip/zulip.git
integration: add branch name to Stash messages.
(imported from commit 3421717acd0e85cb2a1b1f0bd15438f70fd3d82e)
This commit is contained in:
parent
8ec2fd0908
commit
35e764e7d1
|
@ -4091,8 +4091,8 @@ class StashHookTests(AuthedTestCase):
|
|||
content_type="application/x-www-form-urlencoded",
|
||||
**self.api_auth(email))
|
||||
|
||||
self.assertEqual(msg.subject, u"Secret project/Operation unicorn")
|
||||
self.assertEqual(msg.content, """`f259e90` was pushed to **Secret project/Operation unicorn** with:
|
||||
self.assertEqual(msg.subject, u"Secret project/Operation unicorn: master")
|
||||
self.assertEqual(msg.content, """`f259e90` was pushed to **master** in **Secret project/Operation unicorn** with:
|
||||
|
||||
* `f259e90`: Updating poms ...""")
|
||||
|
||||
|
|
|
@ -559,6 +559,7 @@ def api_stash_webhook(request, user_profile, stream=REQ(default='')):
|
|||
try:
|
||||
repo_name = payload["repository"]["name"]
|
||||
project_name = payload["repository"]["project"]["name"]
|
||||
branch_name = payload["refChanges"][0]["refId"].split("/")[-1]
|
||||
commit_entries = payload["changesets"]["values"]
|
||||
commits = [(entry["toCommit"]["displayId"],
|
||||
entry["toCommit"]["message"].split("\n")[0]) for \
|
||||
|
@ -572,9 +573,10 @@ def api_stash_webhook(request, user_profile, stream=REQ(default='')):
|
|||
except (AttributeError, KeyError):
|
||||
stream = 'commits'
|
||||
|
||||
subject = "%s/%s" % (project_name, repo_name)
|
||||
subject = "%s/%s: %s" % (project_name, repo_name, branch_name)
|
||||
|
||||
content = "`%s` was pushed to **%s** with:\n\n" % (head_ref, subject)
|
||||
content = "`%s` was pushed to **%s** in **%s/%s** with:\n\n" % (
|
||||
head_ref, branch_name, project_name, repo_name)
|
||||
content += "\n".join("* `%s`: %s" % (
|
||||
commit[0], commit[1]) for commit in commits)
|
||||
|
||||
|
|
Loading…
Reference in New Issue