git integration: Linkify our commits to point to GitLab.
(imported from commit e8d3c107842680dec9bc6aa84f9548c0f879785d)
This commit is contained in:
parent
9f3766dd4a
commit
c2fb80c282
|
@ -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 for cases where you don't want a notice sent
|
||||||
return None
|
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_API_PATH = "/home/zulip/zulip/api"
|
||||||
ZULIP_SITE = "https://staging.zulip.com"
|
ZULIP_SITE = "https://staging.zulip.com"
|
||||||
|
|
|
@ -70,11 +70,14 @@ def git_repository_name():
|
||||||
|
|
||||||
def git_commit_range(oldrev, newrev):
|
def git_commit_range(oldrev, newrev):
|
||||||
log_cmd = ["git", "log", "--reverse",
|
log_cmd = ["git", "log", "--reverse",
|
||||||
"--pretty=%aE %s", "%s..%s" % (oldrev, newrev)]
|
"--pretty=%aE %H %s", "%s..%s" % (oldrev, newrev)]
|
||||||
commits = ''
|
commits = ''
|
||||||
for ln in subprocess.check_output(log_cmd).splitlines():
|
for ln in subprocess.check_output(log_cmd).splitlines():
|
||||||
email, subject = ln.split(None, 1)
|
author_email, commit_id, subject = ln.split(None, 2)
|
||||||
commits += '!gravatar(%s) %s\n' % (email, subject)
|
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
|
return commits
|
||||||
|
|
||||||
def send_bot_message(oldrev, newrev, refname):
|
def send_bot_message(oldrev, newrev, refname):
|
||||||
|
|
|
@ -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 for cases where you don't want a notice sent
|
||||||
return None
|
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
|
## If properly installed, the Zulip API should be in your import
|
||||||
## path, but if not, set a custom path below
|
## path, but if not, set a custom path below
|
||||||
ZULIP_API_PATH = None
|
ZULIP_API_PATH = None
|
||||||
|
|
Loading…
Reference in a new issue