How to create a local git clone of a mercurial repo?

Kastner Masilko, Friedrich kastner-masilko at at.festo.com
Wed Dec 17 07:56:59 UTC 2014


> From: Harvey Chapman [mailto:hchapman-hg at 3gfp.com]
> 
> I’m not sure how to get the .hg/git folder to be populated without pushing to
> another repo. I tried creating an empty repo, committing to it, and using
> gexport. I also tried the git.intree=1 option, but I don’t think that works. My
> .hg/git and .git are empty. I didn’t know about the gexport/gimport usage
> pattern.

Well, I've just tried it here.
* I've cloned the .NET corefx repo from github via hggit. The .hg/git folder there was approx. 4.5MB thanks to already packed objects. Interestingly enough, the .hg/store folder - containing the equivalent hg history - was smaller with 4.2MB, so I guess the original git repo there is not optimally packed (yet).
* Then I made a local clone with hg, resulting in a pure-hg repository without a .hg/git folder.
* Then I did a "hg gexport" in that repo, and the result was a .hg/git folder, although without packs, just plain old blob objects. This results in a bigger size of ca. 12MB.
* Copying that .hg/git folder to /path/to/repo/.git, doing "git config core.bare false", followed by "git checkout master" works as expected.
* Doing "git gc --aggressive" also reduces the .git folder size to some reasonable 2.7MB.

I've used git 1.7.2.5 on Linux and TortoiseHg (includes hggit) 3.1.2 on Windows for this scenario. No pushing was involved, I've just copied the folder across. Creating a new repo, setting a master bookmark and then doing gexport works just the same.

Regards,
Fritz



Development Engineering Software Suite
Festo Gesellschaft m.b.H.
Linzer Strasse 227
Austria - 1140 Wien

Firmenbuch Wien
FN 38435y
UID: ATU14650108

Tel: +43(1)91075-198
Fax: +43(1)91075-282
www.festo.at

Der Inhalt dieser E-Mail und moeglicher Anhaenge sind ausschliesslich fuer den bezeichneten Adressaten bestimmt.
Jede Form der Kenntnisnahme, Veroeffentlichung, Vervielfaeltigung oder Weitergabe des Inhalts dieser E-Mail und
moeglicher Anhaenge durch unberechtigte Dritte ist unzulaessig. Wir bitten Sie, sich mit dem Absender der E-Mail in
Verbindung zu setzen, falls Sie nicht der Adressat dieser E-Mail sind sowie das Material von Ihrem Computer zu loeschen.

This e-mail and any attachments are confidential and intended solely for the addressee. The perusal, publication, copying or
dissemination of the contents of this e-mail by unauthorised third parties is prohibited. If you are not the intended recipient of this
e-mail, please delete it and immediately notify the sender.



More information about the Mercurial mailing list