git integration: Linkify our commits to point to GitLab.

(imported from commit e8d3c107842680dec9bc6aa84f9548c0f879785d)
This commit is contained in:
Tim Abbott 2013-10-08 14:45:05 -04:00 committed by Steve Howell
parent 9f3766dd4a
commit c2fb80c282
3 changed files with 22 additions and 3 deletions

View file

@ -30,5 +30,13 @@ def commit_notice_destination(repo, branch, commit):
# Return None for cases where you don't want a notice sent
return None
# Modify this function to change how commits are displayed; the most
# common customization is to include a link to the commit in your
# graphical repository viewer, e.g.
#
# return '!gravatar(%s) [%s](https://example.com/commits/%s)\n' % (author, subject, commit_id)
def format_commit_message(author, subject, commit_id):
return '!gravatar(%s) [%s](https://git.zulip.net/eng/zulip/commit/%s)\n' % (author, subject, commit_id)
ZULIP_API_PATH = "/home/zulip/zulip/api"
ZULIP_SITE = "https://staging.zulip.com"

View file

@ -70,11 +70,14 @@ def git_repository_name():
def git_commit_range(oldrev, newrev):
log_cmd = ["git", "log", "--reverse",
"--pretty=%aE %s", "%s..%s" % (oldrev, newrev)]
"--pretty=%aE %H %s", "%s..%s" % (oldrev, newrev)]
commits = ''
for ln in subprocess.check_output(log_cmd).splitlines():
email, subject = ln.split(None, 1)
commits += '!gravatar(%s) %s\n' % (email, subject)
author_email, commit_id, subject = ln.split(None, 2)
if hasattr(config, "format_commit_message"):
commits += config.format_commit_message(author_email, subject, commit_id)
else:
commits += '!gravatar(%s) %s\n' % (author_email, subject)
return commits
def send_bot_message(oldrev, newrev, refname):

View file

@ -49,6 +49,14 @@ def commit_notice_destination(repo, branch, commit):
# Return None for cases where you don't want a notice sent
return None
# Modify this function to change how commits are displayed; the most
# common customization is to include a link to the commit in your
# graphical repository viewer, e.g.
#
# return '!gravatar(%s) [%s](https://example.com/commits/%s)\n' % (author, subject, commit_id)
def format_commit_message(author, subject, commit_id):
return '!gravatar(%s) %s\n' % (author, subject)
## If properly installed, the Zulip API should be in your import
## path, but if not, set a custom path below
ZULIP_API_PATH = None