Skip to content
Snippets Groups Projects
Commit e35ed99f authored by Scott Chacon's avatar Scott Chacon
Browse files

committer info now being kept properly

parent 52b4be85
No related branches found
No related tags found
No related merge requests found
...@@ -27,8 +27,7 @@ ...@@ -27,8 +27,7 @@
- dont convert back properly for some reason - dont convert back properly for some reason
Created in Git: Created in Git:
* different committer in Git objects * encoding field / utf-8
* encoding field
* octopus merge explode/implode * octopus merge explode/implode
WEBSITE WEBSITE
......
...@@ -544,7 +544,8 @@ ...@@ -544,7 +544,8 @@
self._author += text[count] self._author += text[count]
count += 1 count += 1
self._author += text[count] self._author += text[count]
self._author_raw = self._author
count += 1 count += 1
assert text[count] == ' ', "Invalid commit object, " \ assert text[count] == ' ', "Invalid commit object, " \
"author information must be followed by space not %s" % text[count] "author information must be followed by space not %s" % text[count]
count += 1 count += 1
...@@ -547,8 +548,9 @@ ...@@ -547,8 +548,9 @@
count += 1 count += 1
assert text[count] == ' ', "Invalid commit object, " \ assert text[count] == ' ', "Invalid commit object, " \
"author information must be followed by space not %s" % text[count] "author information must be followed by space not %s" % text[count]
count += 1 count += 1
self._author_raw += ' ' + text[count:].split(" ", 1)[0]
self._author_time = int(text[count:].split(" ", 1)[0]) self._author_time = int(text[count:].split(" ", 1)[0])
while text[count] != ' ': while text[count] != ' ':
assert text[count] != '\n', "Malformed author information" assert text[count] != '\n', "Malformed author information"
count += 1 count += 1
...@@ -551,7 +553,8 @@ ...@@ -551,7 +553,8 @@
self._author_time = int(text[count:].split(" ", 1)[0]) self._author_time = int(text[count:].split(" ", 1)[0])
while text[count] != ' ': while text[count] != ' ':
assert text[count] != '\n', "Malformed author information" assert text[count] != '\n', "Malformed author information"
count += 1 count += 1
self._author_raw += text[count:count+6]
self._author_timezone = parse_timezone(text[count:count+6]) self._author_timezone = parse_timezone(text[count:count+6])
count += 1 count += 1
while text[count] != '\n': while text[count] != '\n':
...@@ -569,7 +572,8 @@ ...@@ -569,7 +572,8 @@
self._committer += text[count] self._committer += text[count]
count += 1 count += 1
self._committer += text[count] self._committer += text[count]
self._committer_raw = self._committer
count += 1 count += 1
assert text[count] == ' ', "Invalid commit object, " \ assert text[count] == ' ', "Invalid commit object, " \
"commiter information must be followed by space not %s" % text[count] "commiter information must be followed by space not %s" % text[count]
count += 1 count += 1
...@@ -572,8 +576,9 @@ ...@@ -572,8 +576,9 @@
count += 1 count += 1
assert text[count] == ' ', "Invalid commit object, " \ assert text[count] == ' ', "Invalid commit object, " \
"commiter information must be followed by space not %s" % text[count] "commiter information must be followed by space not %s" % text[count]
count += 1 count += 1
self._commit_time = int(text[count:count+10]) self._committer_raw += ' ' + text[count:].split(" ", 1)[0]
self._commit_time = int(text[count:].split(" ", 1)[0])
while text[count] != ' ': while text[count] != ' ':
assert text[count] != '\n', "Malformed committer information" assert text[count] != '\n', "Malformed committer information"
count += 1 count += 1
...@@ -577,6 +582,7 @@ ...@@ -577,6 +582,7 @@
while text[count] != ' ': while text[count] != ' ':
assert text[count] != '\n', "Malformed committer information" assert text[count] != '\n', "Malformed committer information"
count += 1 count += 1
self._committer_raw += text[count:count+6]
self._commit_timezone = parse_timezone(text[count:count+6]) self._commit_timezone = parse_timezone(text[count:count+6])
count += 1 count += 1
while text[count] != '\n': while text[count] != '\n':
......
...@@ -197,9 +197,9 @@ ...@@ -197,9 +197,9 @@
# hg authors might not have emails # hg authors might not have emails
author = ctx.user() author = ctx.user()
if not '>' in author: if not '>' in author: # TODO : this kills losslessness - die (submodules)?
author = author + ' <none@none>' author = author + ' <none@none>'
commit['author'] = author + ' ' + str(int(time)) + ' ' + seconds_to_offset(timezone) commit['author'] = author + ' ' + str(int(time)) + ' ' + seconds_to_offset(timezone)
message = ctx.description() message = ctx.description()
commit['message'] = ctx.description() + "\n" commit['message'] = ctx.description() + "\n"
...@@ -201,8 +201,12 @@ ...@@ -201,8 +201,12 @@
author = author + ' <none@none>' author = author + ' <none@none>'
commit['author'] = author + ' ' + str(int(time)) + ' ' + seconds_to_offset(timezone) commit['author'] = author + ' ' + str(int(time)) + ' ' + seconds_to_offset(timezone)
message = ctx.description() message = ctx.description()
commit['message'] = ctx.description() + "\n" commit['message'] = ctx.description() + "\n"
extra = ctx.extra()
if 'committer' in extra:
commit['committer'] = extra['committer']
# HG EXTRA INFORMATION # HG EXTRA INFORMATION
add_extras = False add_extras = False
extra_message = '' extra_message = ''
...@@ -541,9 +545,7 @@ ...@@ -541,9 +545,7 @@
files.remove(removefile) files.remove(removefile)
extra = {} extra = {}
# *TODO : if committer is different than author, add it to extra
# if named branch, add to extra # if named branch, add to extra
if hg_branch: if hg_branch:
extra['branch'] = hg_branch extra['branch'] = hg_branch
...@@ -547,6 +549,13 @@ ...@@ -547,6 +549,13 @@
# if named branch, add to extra # if named branch, add to extra
if hg_branch: if hg_branch:
extra['branch'] = hg_branch extra['branch'] = hg_branch
# if committer is different than author, add it to extra
if not commit._author_raw == commit._committer_raw:
extra['committer'] = commit._committer_raw
if hg_branch:
extra['branch'] = hg_branch
text = strip_message text = strip_message
date = datetime.datetime.fromtimestamp(commit.author_time).strftime("%Y-%m-%d %H:%M:%S") date = datetime.datetime.fromtimestamp(commit.author_time).strftime("%Y-%m-%d %H:%M:%S")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment