Re: Mercurial to git converter.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Stelian Pop <stelian <at> popies.net> writes:

> I switched recently from Mercurial to git for some of my projects, and
> needed a conversion tool with branch support (unlike tailor). I didn't
> find any, so I ended up writing my own one. 
> 
> hg-to-git.py can probably be greatly improved (it's a rather crude
> combination of shell and python) but it does already work quite well for
> me. [...]

Thanks for that. One small problem is that it does not get the changelog right 
if a commit is made on a local branch. It thinks the "branch:" line is part of 
the changelog.

Here's a patch to fix that:

diff -u -r1.1 hg-to-git.py
--- hg-to-git.py
+++ hg-to-git.py
@@ -151,7 +151,7 @@
         mparent = None

     (fdcomment, filecomment) = tempfile.mkstemp()
-    csetcomment = os.popen('hg log -r %d -v | grep -v ^changeset: | grep -v 
^parent: | grep -v ^user: | grep -v ^date | grep -v ^files: | grep -v 
^description: | grep -v ^tag:' % cset).read().strip()
+    csetcomment = os.popen('hg log -r %d -v | egrep -v "^(changeset|parent|
user|date|files|description|tag|branch):" ' % cset).read().strip()
     os.write(fdcomment, csetcomment)
     os.close(fdcomment)


Nick.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux