mirror of
https://github.com/odoo/runbot.git
synced 2025-03-27 13:25:47 +07:00
[FIX] runbot: fix _get_commit_infos
This commit is contained in:
parent
c2ef253ec9
commit
383352d88e
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
import datetime
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from ..common import os, RunbotException, make_github_session
|
from ..common import os, RunbotException, make_github_session
|
||||||
@ -42,11 +43,11 @@ class Commit(models.Model):
|
|||||||
return super().create(vals_list)
|
return super().create(vals_list)
|
||||||
|
|
||||||
def _get_commit_infos(self, sha, repo):
|
def _get_commit_infos(self, sha, repo):
|
||||||
fields = ['date', 'author', 'author_email', 'commiter', 'commiter_email', 'subject']
|
fields = ['date', 'author', 'author_email', 'committer', 'committer_email', 'subject']
|
||||||
pretty_format = '%00'.join(['%ct', '%an', '%ae', '%cn', '%ce', '%s'])
|
pretty_format = '%x00'.join(['%ct', '%an', '%ae', '%cn', '%ce', '%s'])
|
||||||
vals = {}
|
vals = {}
|
||||||
try:
|
try:
|
||||||
vals = zip(fields, repo._git(['show', '-s', f'--pretty=format:{pretty_format}', sha]).split('\x00'))
|
vals = dict(zip(fields, repo._git(['show', '-s', f'--pretty=format:{pretty_format}', sha]).split('\x00')))
|
||||||
vals['date'] = datetime.datetime.fromtimestamp(int(vals['date']))
|
vals['date'] = datetime.datetime.fromtimestamp(int(vals['date']))
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
_logger.warning('git show failed with message %s', e.output.decode())
|
_logger.warning('git show failed with message %s', e.output.decode())
|
||||||
|
Loading…
Reference in New Issue
Block a user