I want to use hggit. Not because I like git, but because Xcode 4 uses git. So I need a two way bridge between hg and git, which hggit provides.
1. Install dulwich:
sudo easy_install dulwich
Have multiple Pythons installed? Make sure you use correct easy_install, for example:
sudo /usr/bin/easy_install2.6 dulwich
2. Get hggit, either with git or hg (guess which one I prefer):
hg clone http://bitbucket.org/durin42/hg-git hggit
3. Edit your ~/.hgrc; add the hggit and bookmarks extensions:
[extensions] . . . bookmarks= hggit=/Users/someone/projects/hggit/hggit/
4. In your Mercurial repository, punch this in:
hg bookmark master -r default hg gexport
and voilà! You have a .git repository.
5. To pull git changesets (commits) back into hg, it should require just:
I didn’t yet get here.
Xcode 4 simply refuses to work with git repositories created from Mercurial. It recognizes the branches, but not the log itself. No idea why yet. Ah well.
Update: Xcode 4 is sensitive to repositories being “bare”, whatever that means for Git. (Apparently that is a locally created, non-cloned Git repository without a “remote”.) Edit .git/config, and change “bare = true” to “bare = false”. This allows you to see the history.
But don’t do that. There appear to be other incompatibilities that I could not fix. For example, all files are marked as “D-eleted”. Also, setting bare to false will make the following steps fail. So what you really want to do is:
cd .. git clone MyProject MyProjectGIT # now mess with the project in MyProjectGIT git commit -m "Whatever" git push cd .. cd MyProject hg gimport
(First few commands are run through Xcode 4 GUI, of course.)
Don’t forget that your git username and email is unconfigured. (Absurdly, I could not find GUI in Xcode 4 to edit this!) Terminal back to the rescue again.
git config --global user.name "Your Name" git config --global user.email firstname.lastname@example.org
Tip me with Bitcoin to: 1ASA9q5VQUxPZvit8X2AP4JYzPcSDk7dFV or using ChangeTip (button below)