Mercurial > hg > gitserve
changeset 2847:a75d609ded05
Restore commiter string if we see it as the last line of the commit message
author | Josef "Jeff" Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sat, 02 Sep 2006 22:58:02 -0400 |
parents | a3295be6de46 |
children | afb106e08cda |
files | hgext/gitserve.py |
diffstat | 1 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/gitserve.py Sat Sep 02 22:33:38 2006 -0400 +++ b/hgext/gitserve.py Sat Sep 02 22:58:02 2006 -0400 @@ -236,14 +236,19 @@ print "making tree %s" % (hash,) return hash -def make_commit_object(tree, user, dts, hgmsg, parents): +def make_commit_object(tree, author, committer, dts, hgmsg, parents): msg = "tree %s\n" % (tree,) for p in parents: if p == node.nullid: continue msg += "parent %s\n" % (h2g[p],) - msg += "author %s %s\n" % (user, dts) - msg += "committer %s %s\n\n" % (user, dts) + msg += "author %s %s\n" % (author, dts) + if committer: + print "got commiter: \"%s\"" % (committer,) + msg += "committer %s\n\n" % (committer, ) + else: + print "faking committer: \"%s %s\"" % (author, dts) + msg += "committer %s %s\n\n" % (author, dts) msg += "%s" % (hgmsg,) hash = hash_object("commit", msg) @@ -306,7 +311,14 @@ gittree = make_tree_object(tree) - gitcommit = make_commit_object(gittree, user, "%d %s" % (int(t[0]), tz(t[1])), hgmsg, pars) + try: + lastline = hgmsg.split("\n")[-2] + committer = lastline.startswith("committer: ") and lastline[len("committer: "):] or None + hgmsg = "\n".join(hgmsg.split("\n")[:-2]) + except: + committer = None + + gitcommit = make_commit_object(gittree, user, committer, "%d %s" % (int(t[0]), tz(t[1])), hgmsg, pars) h2g[r] = gitcommit g2h[gitcommit] = r