[PATCH] write the git commit id into the commit message

Stefano Stabellini stefano.stabellini at eu.citrix.com
Thu Sep 18 05:19:15 CDT 2008


Hi all,
I am about to setup an up to date HG mirror of a git repository, very
much like kernel.org provides up to date git mirrors for other
repositories, only the other way around :)
I am going to use hg convert to do that, and it seems to do the job just
fine, so I want to thank you for this great tool.
The only issue is that I need to have somewhere in the mercurial commit
message the git commit id, so it would be much easier to get the correct
commit reference.
I hacked mercurial to do just that, I only added one line of code.
I would appreciate if you consider adding this feature, even optional
would be fine, because I think it would be very useful to all the people
that maintain mercurial mirrors.
Thanks,

Stefano Stabellini

---

diff -r f29b674cc221 hgext/convert/git.py
--- a/hgext/convert/git.py	Wed Sep 17 11:34:37 2008 +0200
+++ b/hgext/convert/git.py	Thu Sep 18 11:13:59 2008 +0100
@@ -98,6 +98,7 @@
                 committer = self.recode(committer)
                 message += "\ncommitter: %s\n" % committer
             if n == "parent": parents.append(v)
+        message += 'git-commit-id: %s\n' % manifest
 
         tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:]
         tz = -int(tzs) * (int(tzh) * 3600 + int(tzm))


More information about the Mercurial-devel mailing list