1
votes

I would like to use a mercurial subrepo as as git submodule. I have followed the instruction posted to the exact same question here 1. However even though all the setup steps completed successfully and without error when cloning the main repository and its subrepos I am running into errors.

Additionally the question at 1 is 5 years old and I am afraid git has changed a lot in that time and therefore I feel this question merits an answer

When I clone I run the following:

git clone --recursive

I get the following error:

Cloning into '/home/user/projects/mainrepo/project/hgsubrepo'... repository does not exist. fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

fatal: clone of '[email protected]:mischief/ippan2.git/project/hgsubrepo' into submodule path '/home/user/projects/mainrepo/project/hgsubrepo' failed Failed to clone 'project/hgsubrepo'. Retry scheduled Cloning into '/home/user/projects/mainrepo/project/hgsubrepo'... repository does not exist. fatal: Could not read from remote repository.

If I interpret the results correctly git is trying to infer an remote URL for hgsubrepo but using git protocol not mercurial as I would expect given my understanding of the reponse in 1

Is there a different/better/new way to handle mercurial subrepos within git?

edit 1: the main repository lives in the local folder

/home/user/projects/mainrepo

the hg repository lives in

/home/user/project/mainrepo/projects/

1

1 Answers

-1
votes

Try git-remote-hg; add 'hg::' prefix to the URL of mercurial repository.