Set change url to gitweb URL.

So that status pages can easily link to gitweb urls of ref-update
triggered changes.

Change-Id: Id9b708a473d92c30727f66578a0174f18c657723
Reviewed-on: https://review.openstack.org/18602
Approved: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
This commit is contained in:
James E. Blair 2012-12-23 09:39:55 -08:00 committed by Jenkins
parent 8dbd56aff0
commit c44b138d42
2 changed files with 9 additions and 0 deletions

View File

@ -247,6 +247,8 @@ class Pipeline(object):
ret = {}
if hasattr(changeish, 'url') and changeish.url is not None:
ret['url'] = changeish.url
else:
ret['url'] = None
ret['id'] = changeish._id()
ret['project'] = changeish.project.name
ret['jobs'] = []
@ -607,6 +609,7 @@ class TriggerEvent(object):
change.ref = self.ref
change.oldrev = self.oldrev
change.newrev = self.newrev
change.url = trigger.getGitwebUrl(project, sha=self.newrev)
return change

View File

@ -342,3 +342,9 @@ class Gerrit(object):
port = 29418
url = 'ssh://%s@%s:%s/%s' % (user, server, port, project.name)
return url
def getGitwebUrl(self, project, sha=None):
url = '%s/gitweb?p=%s.git' % (self.baseurl, project)
if sha:
url += ';a=commitdiff;h=' + sha
return url