Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
af8900f3
Commit
af8900f3
authored
Nov 13, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement getting revision information for Mercurial
Issue #511 Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
b2c294bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
25 deletions
+34
-25
weblate/trans/tests/test_vcs.py
weblate/trans/tests/test_vcs.py
+3
-1
weblate/trans/vcs.py
weblate/trans/vcs.py
+31
-24
No files found.
weblate/trans/tests/test_vcs.py
View file @
af8900f3
...
...
@@ -264,7 +264,9 @@ class VCSHgTest(VCSGitTest):
return
def
test_revision_info
(
self
):
return
# Latest commit
info
=
self
.
repo
.
get_revision_info
(
self
.
repo
.
last_revision
)
self
.
check_valid_info
(
info
)
def
test_set_committer
(
self
):
self
.
repo
.
set_committer
(
u'Foo Bar Žač'
,
'foo@example.net'
)
...
...
weblate/trans/vcs.py
View file @
af8900f3
...
...
@@ -656,13 +656,24 @@ class HgRepository(Repository):
TODO
"""
template = '''
author_name: {person(author)}
author_email: {email(author)}
author: {author}
authordate: {rfc822date(date)}
commit_name: {person(author)}
commit_email: {email(author)}
commit: {author}
commitdate: {rfc822date(date)}
commit: {short(note)}
message:
{desc}
'''
text = self.execute([
'
log
',
'
-
1
',
'
--
format
=
fuller
',
'
--
date
=
rfc
',
'
--
abbrev
-
commit
',
revision
'
--
limit
', '
1
',
'
--
template
', template,
'
--
rev
', revision
])
result = {
...
...
@@ -670,29 +681,25 @@ class HgRepository(Repository):
}
message = []
header = True
for line in text.splitlines():
if header:
if not line:
header = False
elif line.startswith('
commit
'):
result['
shortrevision
'] = line.split()[1]
else:
name, value = line.strip().split('
:
', 1)
value = value.strip()
name = name.lower()
if '
date
' in name:
result[name] = parser.parse(value)
else:
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]
line = line.strip()
if not line:
continue
if not header:
message.append(line)
continue
if line == '
message
:
':
header = False
continue
name, value = line.strip().split('
:
', 1)
value = value.strip()
name = name.lower()
if '
date
' in name:
result[name] = parser.parse(value)
else:
message.append(line.strip())
result[name] = value
result['
message
'] = '
\
n
'.join(message)
result['
summary
'] = message[0]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment