frej / fast-export

A mercurial to git converter using git-fast-import
http://repo.or.cz/w/fast-export.git
808 stars 255 forks source link

Documentation Unclear #277

Closed fabio-solidify closed 2 years ago

fabio-solidify commented 2 years ago

Hi! I have a hard time to follow the documentation due to several ambiguities and would like a clarification.

The wiki shows a example repository that has the following folder structure;

Example mercurial repo folder structure (~/mercurial): src/... subrepo/subrepo1 `subrepo/subrepo2

Does it mean that the subrepo is located in '~/mercurial/src/subrepo/subrepo1' or '~/mercurial/subrepo/subrepo1'?

Is the first part of this path 'subrepo/subrepo1', a subrepo? Meaning there's two subrepos here. Or is 'subrepo' just a folder that contains a subrepo (subrepo1)? And is not itself a subrepo?

Then you write that in order to convert the repo we have to do something in the lines of

mkdir submodule1
cd submodule1
git init
hg-fast-export.sh -r ~/mercurial/subrepo1

So the subrepo path is now located at '~/mercurial/subrepo1', what happened to the 'subrepo' folder? Shouldn't it be;

mkdir submodule1
cd submodule1
git init
hg-fast-export.sh -r ~/mercurial/subrepo/subrepo1

I also cant understand how the mapping file should be configured.

cd ~/imported-gits
cat > submodule-mappings << EOF
"subrepo/subrepo1"="../submodule1"
"subrepo/subrepo2"="../submodule2"
EOF

is 'subrepo/subrepo1' supposed to be relative to the ~/mercurial repo provided with the '-r' switch when executing the script? Or do I need to provide the whole path?

This questions might be stupid but I cant really figure this out. I have a problem with my .gitmodules file not being generated and it has to be something wrong with this paths and how I have setup my mapping file.

frej commented 2 years ago

Have a look at #279 and see if clears things up.

is 'subrepo/subrepo1' supposed to be relative to the ~/mercurial repo provided with the '-r' switch when executing the script? Or do I need to provide the whole path?

subrepo/subrepo1 tells fast-export that the Git submodule corresponding to the subrepo located at the path subrepo/subrepo1 inside the repo we are converting is reachable at the location to the right of the =. It is a path inside the Mercurial repo we are converting.

The right hand side in the mapping file is a relative path, telling both Git and fast-export where to find the submodules. By using a relative path we can, for example, push all three repos to Github and Git will be smart enough to, when the super repo has been cloned, find the subrepos.

fabio-solidify commented 2 years ago

Hi! Thank you for the response and the updated documentation. Its much clearer now.