mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
runbot add author and subject support
This commit is contained in:
parent
33304c77ec
commit
d075d1e8a0
@ -208,11 +208,21 @@ class runbot_repo(osv.osv):
|
||||
else:
|
||||
repo.git(['fetch', '-p', 'origin', '+refs/heads/*:refs/heads/*'])
|
||||
repo.git(['fetch', '-p', 'origin', '+refs/pull/*/head:refs/pull/*'])
|
||||
out = repo.git(['for-each-ref', '--format', '["%(refname)","%(objectname)","%(authordate:iso8601)"]', '--sort=-committerdate', 'refs/heads'])
|
||||
refs = [simplejson.loads(i) for i in out.split('\n') if i]
|
||||
out = repo.git(['for-each-ref', '--format', '["%(refname)","%(objectname)","%(authordate:iso8601)"]', '--sort=-committerdate', 'refs/pull'])
|
||||
refs += [simplejson.loads(i) for i in out.split('\n') if i]
|
||||
for name, sha, date in refs:
|
||||
|
||||
fields = ['refname','objectname','authordate:iso8601','authorname','subject']
|
||||
fmt = "%00".join(["%("+i+")" for i in fields])
|
||||
out = repo.git(['for-each-ref', '--format', fmt, '--sort=-committerdate', 'refs/heads', 'refs/pull'])
|
||||
out = out.strip()
|
||||
refs = []
|
||||
for l in out.split('\n'):
|
||||
ref = []
|
||||
for i in l.split('\x00'):
|
||||
try:
|
||||
ref.append(i.decode('utf-8'))
|
||||
except UnicodeDecodeError:
|
||||
ref.append('')
|
||||
refs.append(ref)
|
||||
for name, sha, date, author, subject in refs:
|
||||
# create or get branch
|
||||
branch_ids = self.pool['runbot.branch'].search(cr, uid, [('repo_id', '=', repo.id), ('name', '=', name)])
|
||||
if branch_ids:
|
||||
@ -228,7 +238,13 @@ class runbot_repo(osv.osv):
|
||||
build_ids = self.pool['runbot.build'].search(cr, uid, [('branch_id', '=', branch.id), ('name', '=', sha)])
|
||||
if not build_ids:
|
||||
_logger.debug('repo %s branch %s new build found revno %s', branch.repo_id.name, branch.name, sha)
|
||||
self.pool['runbot.build'].create(cr, uid, {'branch_id': branch.id, 'name': sha})
|
||||
v = {
|
||||
'branch_id': branch.id,
|
||||
'name': sha,
|
||||
'author': author,
|
||||
'subject': subject,
|
||||
}
|
||||
self.pool['runbot.build'].create(cr, uid, v)
|
||||
|
||||
def scheduler(self, cr, uid, ids=None, context=None):
|
||||
for repo in self.browse(cr, uid, ids, context=context):
|
||||
@ -391,8 +407,8 @@ class runbot_build(osv.osv):
|
||||
'dest': fields.function(_get_dest, type='char', string='Dest', readonly=1, store=True),
|
||||
'domain': fields.function(_get_domain, type='char', string='URL'),
|
||||
'date': fields.datetime('Commit date'),
|
||||
'committer': fields.char('Comitter'),
|
||||
'log': fields.text('Commit log'),
|
||||
'author': fields.char('Author'),
|
||||
'subject': fields.text('Subject'),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
'result': fields.char('Result'), # ok, ko
|
||||
'pid': fields.integer('Pid'),
|
||||
|
@ -117,8 +117,8 @@
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="date"/>
|
||||
<field name="committer"/>
|
||||
<field name="log"/>
|
||||
<field name="author"/>
|
||||
<field name="subject"/>
|
||||
<field name="port"/>
|
||||
<field name="dest"/>
|
||||
<field name="state"/>
|
||||
@ -141,7 +141,7 @@
|
||||
<field name="repo_id"/>
|
||||
<field name="dest"/>
|
||||
<field name="date"/>
|
||||
<field name="committer"/>
|
||||
<field name="author"/>
|
||||
<field name="state"/>
|
||||
<field name="port"/>
|
||||
<field name="job"/>
|
||||
@ -340,7 +340,9 @@
|
||||
<t t-if="bu.state in ['running','done'] and bu.result == 'ok'"><t t-set="klass">success</t></t>
|
||||
<td t-attf-class="{{klass}}">
|
||||
<t t-call="runbot.build_button"><t t-set="klass">btn-group-sm</t></t>
|
||||
<t t-esc="bu.dest"/><br/>
|
||||
<t t-esc="bu.subject[:24] if bu.subject else ''"/><br/>
|
||||
<t t-esc="bu.author"/><br/>
|
||||
<small><t t-esc="bu.dest"/></small><br/>
|
||||
<t t-call="runbot.build_name"/>
|
||||
</td>
|
||||
</t>
|
||||
@ -427,6 +429,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<p>
|
||||
Subject: <t t-esc="build.subject[:24] if build.subject else ''"/><br/>
|
||||
Author: <t t-esc="build.author"/><br/>
|
||||
</p>
|
||||
<table class="table table-condensed table-striped">
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
|
Loading…
Reference in New Issue
Block a user