only create a range url when we have commits

This commit is contained in:
jesopo 2019-06-28 06:51:58 +01:00
parent e0b7495ecc
commit 1e30e76cad

View file

@ -184,13 +184,17 @@ class GitHub(object):
branch = utils.irc.color(branch, colors.COLOR_BRANCH)
author = utils.irc.bold(data["pusher"]["name"])
first_id = data["before"]
last_id = data["commits"][-1]["id"]
range_url = self._short_url(
COMMIT_RANGE_URL % (full_name, first_id, last_id))
range_url = None
if len(data["commits"]):
first_id = data["before"]
last_id = data["commits"][-1]["id"]
range_url = self._short_url(
COMMIT_RANGE_URL % (full_name, first_id, last_id))
single_url = COMMIT_URL % (full_name, "%s"),
return self._format_push(branch, author, data["commits"],
data["forced"], COMMIT_URL % (full_name, "%s"), range_url)
data["forced"], single_url, range_url)
def _format_push(self, branch, author, commits, forced, single_url,
range_url):