# HG changeset patch # User Scott Chacon # Date 1241841422 25200 # Node ID e35ed99fa691f2726ae5e243d4d2a78b029e7575 # Parent 52b4be85151da39ad52a0f53a73c773346328185 committer info now being kept properly diff -r 52b4be85151d -r e35ed99fa691 TODO.txt --- a/TODO.txt Fri May 08 20:54:33 2009 -0700 +++ b/TODO.txt Fri May 08 20:57:02 2009 -0700 @@ -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 -r 52b4be85151d -r e35ed99fa691 dulwich/objects.py --- a/dulwich/objects.py Fri May 08 20:54:33 2009 -0700 +++ b/dulwich/objects.py Fri May 08 20:57:02 2009 -0700 @@ -544,14 +544,17 @@ 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 + 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 + self._author_raw += text[count:count+6] self._author_timezone = parse_timezone(text[count:count+6]) count += 1 while text[count] != '\n': @@ -569,14 +572,17 @@ 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 - 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 + self._committer_raw += text[count:count+6] self._commit_timezone = parse_timezone(text[count:count+6]) count += 1 while text[count] != '\n': diff -r 52b4be85151d -r e35ed99fa691 git_handler.py --- a/git_handler.py Fri May 08 20:54:33 2009 -0700 +++ b/git_handler.py Fri May 08 20:57:02 2009 -0700 @@ -197,12 +197,16 @@ # 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 + ' ' 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,12 +545,17 @@ 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 + + # 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")