Commit 8c8b300d authored by Michal Čihař's avatar Michal Čihař

Merge branch 'master' into bootstrap

Conflicts:
	weblate/html/git-commit-info.html
parents 272fe53e 58285c13
{% load i18n %}
<code class="git-commit" data-toggle="tooltip" data-placement="bottom" data-title="
{% blocktrans with commit.hexsha as hash %}Commit {{ hash }}{% endblocktrans %}<br />
{% blocktrans with commit.author.name as author and commit.authored_date|date:"DATETIME_FORMAT" as date %}Authored by {{ author }} on {{ date }}{% endblocktrans %}
">{{ commit.hexsha|slice:":8" }}</code>
{% blocktrans with commit.revision as hash %}Commit {{ hash }}{% endblocktrans %}<br />
{% blocktrans with commit.author_name as author and commit.authordate|date:"DATETIME_FORMAT" as date %}Authored by {{ author }} on {{ date }}{% endblocktrans %}<br />
{{ commit.summary }}
">{{ commit.shortrevision }}</code>
......@@ -408,7 +408,9 @@ class SubProject(models.Model, PercentMixin, URLMixin, PathMixin):
'''
Returns latest remote commit we know.
'''
return self.repository.last_remote_revision
return self.repository.get_revision_info(
self.repository.last_remote_revision
)
def get_repo_url(self):
'''
......
......@@ -22,6 +22,7 @@ Minimal distributed version control system abstraction for Weblate needs.
"""
import subprocess
import os.path
import email.utils
from dateutil import parser
from weblate.trans.util import get_clean_env
......@@ -300,10 +301,18 @@ class GitRepository(Repository):
"""
Returns dictionary with detailed revision information.
"""
text = self.execute(
['show', '--format=fuller', '--date=rfc', '--no-patch', revision]
)
result = {}
text = self.execute([
'show',
'--format=fuller',
'--date=rfc',
'--no-patch',
'--abbrev-commit',
revision
])
result = {
'revision': revision,
}
message = []
......@@ -314,14 +323,19 @@ class GitRepository(Repository):
if not line:
header = False
elif line.startswith('commit'):
continue
result['shortrevision'] = line.split()[1]
else:
name, value = line.strip().split(':', 1)
if 'Date' in name:
result[name.lower()] = parser.parse(value.strip())
value = value.strip()
name = name.lower()
if 'date' in name:
result[name] = parser.parse(value)
else:
result[name.lower()] = value.strip()
result[name] = value
if '@' in value:
parsed = email.utils.parseaddr(value)
result['{0}_name'.format(name)] = parsed[0]
result['{0}_email'.format(name)] = parsed[1]
else:
message.append(line.strip())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment