I have a project versioned with git and our client wants to access it with Mercurial, so our idea was to convert the project using the plugin “hg-git”.
The error is thrown when cloning the "converted" repository with a hg command following these steps:
The project structure was automatically changed by the plugin and a new folder containing the .hg files was generated inside the my folder and looks like that:
|-My_awesome_android_app
|–.git
|– My_awesome_android_app_hg
|-.hg
|– android_app_files_in_this_folder
When I try to import using Mercurial commands the "converted" git project from Bitbucket it is aborted:
hg clone git@bitbucket.org:xxxxx/My_awesome_android_app.git
destination directory: My_awesome_android_app-git
importing git objects into hg
updating to branch default
abort: path 'fluffy-bitbucket-git-hg/.hg/00changelog.i' is inside nested repo 'fluffy-bitbucket-git-hg'
To try to solve the "nest" problem I read on some SO post that the .hg folder has to be on the same level as the .git folder. The structure changed to:
|-My_awesome_android_app
|–.git
|–.hg
|– android_app_files_in_this_folder
I commit the changes, push to Git repo, then tried again to hg pull:
hg clone git@bitbucket.org:xxxxx/My_awesome_android_app.git
destination directory: My_awesome_android_app-git
importing git objects into hg
updating to branch default
abort: path contains illegal component: .hg/00changelog.i
I have been looking for almost 2 days to solve this second error, reinstalled from brew everything, it failed, then macport again, checked python and mercurial, tried to create a new bitbucket repo and start from scratch, looked on GG and SO other related posts, modified the .hgrc file, I still get the error.
I tried another option: "Mirror git and mercurial repos the lazy way" by Greg Malcolm (same local project mirrors/sync both a git repository on one side and a mercurial on the other).
That was the only one working solution during my test. But that is not exactly what I wanted to do as you have 2 different repo to sync and I would like to have only one with the .git and .hg in it.
I hope someone can help me either to solve the error message for the solution using a single Git repo accepting both .git push and hg pull and or tell me if the "mirroring" of 2 different repo (one git, one hg) is the only working option.
Thx!
Config / installation: Mac Os Sierra Installed the rest as said in this SO answer - macports - python 2.7 - Mercurial - hggit
Content of .hgrc file :
[ui]
username = xxxx xxxxxx <pxxxxx.xxxxxx@xxxx.xxx> (in reality it is my mail adress)
ssh = ssh -C
[extensions]
hgext.convert=
hgext.bookmarks =
hggit =
[git]
intree = True
The "convert" command is not part of hg-git, but a standalone extension and does not create a repository that is compatible with the original Git repository.
In order to transparently use Mercurial for a remotely hosted git repository with hg-git, simply clone the repository directly from the Git URL, e.g.:
hg clone git@bitbucket.org:user/repo
You should then be able to pull from and push to that repository directly using the normal Mercurial commands.