diff --git a/TODO.txt b/TODO.txt index 52b4be85151da39ad52a0f53a73c773346328185_VE9ETy50eHQ=..e35ed99fa691f2726ae5e243d4d2a78b029e7575_VE9ETy50eHQ= 100644 --- a/TODO.txt +++ b/TODO.txt @@ -27,8 +27,7 @@ - dont convert back properly for some reason Created in Git: -* different committer in Git objects -* encoding field +* encoding field / utf-8 * octopus merge explode/implode WEBSITE diff --git a/dulwich/objects.py b/dulwich/objects.py index 52b4be85151da39ad52a0f53a73c773346328185_ZHVsd2ljaC9vYmplY3RzLnB5..e35ed99fa691f2726ae5e243d4d2a78b029e7575_ZHVsd2ljaC9vYmplY3RzLnB5 100644 --- a/dulwich/objects.py +++ b/dulwich/objects.py @@ -544,7 +544,8 @@ self._author += text[count] count += 1 self._author += text[count] + self._author_raw = self._author count += 1 assert text[count] == ' ', "Invalid commit object, " \ "author information must be followed by space not %s" % text[count] count += 1 @@ -547,8 +548,9 @@ count += 1 assert text[count] == ' ', "Invalid commit object, " \ "author information must be followed by space not %s" % text[count] count += 1 + self._author_raw += ' ' + text[count:].split(" ", 1)[0] self._author_time = int(text[count:].split(" ", 1)[0]) while text[count] != ' ': assert text[count] != '\n', "Malformed author information" count += 1 @@ -551,7 +553,8 @@ self._author_time = int(text[count:].split(" ", 1)[0]) while text[count] != ' ': assert text[count] != '\n', "Malformed author information" count += 1 + self._author_raw += text[count:count+6] self._author_timezone = parse_timezone(text[count:count+6]) count += 1 while text[count] != '\n': @@ -569,7 +572,8 @@ self._committer += text[count] count += 1 self._committer += text[count] + self._committer_raw = self._committer count += 1 assert text[count] == ' ', "Invalid commit object, " \ "commiter information must be followed by space not %s" % text[count] count += 1 @@ -572,8 +576,9 @@ count += 1 assert text[count] == ' ', "Invalid commit object, " \ "commiter information must be followed by space not %s" % text[count] 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] != ' ': assert text[count] != '\n', "Malformed committer information" count += 1 @@ -577,6 +582,7 @@ while text[count] != ' ': assert text[count] != '\n', "Malformed committer information" count += 1 + self._committer_raw += text[count:count+6] self._commit_timezone = parse_timezone(text[count:count+6]) count += 1 while text[count] != '\n': diff --git a/git_handler.py b/git_handler.py index 52b4be85151da39ad52a0f53a73c773346328185_Z2l0X2hhbmRsZXIucHk=..e35ed99fa691f2726ae5e243d4d2a78b029e7575_Z2l0X2hhbmRsZXIucHk= 100644 --- a/git_handler.py +++ b/git_handler.py @@ -197,9 +197,9 @@ # hg authors might not have emails author = ctx.user() - if not '>' in author: + if not '>' in author: # TODO : this kills losslessness - die (submodules)? author = author + ' <none@none>' commit['author'] = author + ' ' + str(int(time)) + ' ' + seconds_to_offset(timezone) message = ctx.description() commit['message'] = ctx.description() + "\n" @@ -201,8 +201,12 @@ author = author + ' <none@none>' commit['author'] = author + ' ' + str(int(time)) + ' ' + seconds_to_offset(timezone) message = ctx.description() commit['message'] = ctx.description() + "\n" + extra = ctx.extra() + if 'committer' in extra: + commit['committer'] = extra['committer'] + # HG EXTRA INFORMATION add_extras = False extra_message = '' @@ -541,9 +545,7 @@ files.remove(removefile) extra = {} - - # *TODO : if committer is different than author, add it to extra - + # if named branch, add to extra if hg_branch: extra['branch'] = hg_branch @@ -547,6 +549,13 @@ # if named branch, add to extra if 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 date = datetime.datetime.fromtimestamp(commit.author_time).strftime("%Y-%m-%d %H:%M:%S")