Here are the steps I've taken to build the repo and subrepos.
Everything is hosted on Bitbucket.
Here is directory structure: mainrepo --subrepo1 (main project) --subrepo2 (class library)
I've spent countless hours trying to get this working and I must be missing something obvious.
What is causing this error and what am I missing? I need to be able to add additional subrepos as the project grows.
The steps that I took to make my example are as follows:
MainRepo
on BitBucketSubRepo
on BitBucketMainRepo
SubRepo
as a sub-directory of MainRepo
.hgsub
file with the contents SubRepo = ../SubRepo
.hgsub
file to MainRepo
, commit and pushSubRepo2
on BitBucketSubRepo2
as a sub-directory of MainRepo
.hgsub
and add SubRepo2 = ../SubRepo2
MainRepo
againFrom then on, I could edit either of the two sub-repositories and see that they had changed when looking at MainRepo
in the workbench. I could then commit the changes to the sub-repositories, commit the sub-repository states in MainRepo
and push all three repositories with a single push from MainRepo
The way that you said that it was set up by TortoiseHg in your other question (subrepo = subrepo
) won't work with BitBucket because of how their structure is. I think that you can only have repositories at the top level like this:
bitbucket.org/SteveKaye/MainRepo
bitbucket.org/SteveKaye/SubRepo
whereas having the line subrepo = subrepo
is trying to set up a structure like this:
bitbucket.org/SteveKaye/MainRepo
bitbucket.org/SteveKaye/MainRepo/SubRepo
When you push this it looks like it is trying to push SubRepo
into MainRepo
which would explain the unrelated repository error message that you are getting.
The .hgsub
syntax is such that the left of the equals defines the folder in the working copy where the repository will be and the right of the equals defines where to get it from. When the right of the equals is a relative path, it defines where the sub-repository is on the central server relative to the main repository. So in the example above, you go up one folder to bitbucket.org/SteveKaye
and the SubRepo
is contained in that folder.
The documentation says:
The source path of a Mercurial repository can either be a relative or absolute path or URL. It is generally recommended to use trivial relative paths where the source path is the same as the working dir path: This will ensure that the subrepositories always can be found 'in place'.
Other relative paths can be used if the subrepositories can't be hosted 'in place', for example because of limitations of a central repository or hosting service. A consequence of using such non-trivial relative paths is that clones can't be cloned.
This looks relevant to your situation when using BitBucket and I'd expect that your clones can't be cloned as it says in the last sentence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With