Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using subrepositories with bitbucket and ToritoiseHg

I have subrepository structure as following in TortoiseHg:

/MainFolder/
/MainFolder/SubFolder1
/MainFolder/SubFolder2

MainFolder is a private repository on bitbucket SubFolder1 is a private repository on bitbucket SubFolder2 is a private repository on bitbucket

The file .hgsub inside MainFolder looks like this:

SubFolder1 = SubFolder1
SubFolder2 = SubFolder2

The file .hgsubstat inside MainFolder also have valid guids and subrepository names.

The problem is whenever I try to push to bitbucket for MainFolder, first it pushes the MainFolder, then SubFolder1, but when it gets to SubFolder2, TortoiseHg throws error "abort: repository is unrelated".

When i check my MainFolder repository on bitbucket, it has actually contents of SubFolder1 (it should be listed there as subrepository).

How can I fix this so that the MainFolder is correctly uploaded as parent repository and SubFolder1 and SubFolder2 are listed as its sub-repository on bitbucket?

like image 716
samirjaiswal Avatar asked Dec 06 '12 19:12

samirjaiswal


1 Answers

The example shown in bitbucket documentation requires to rename repositories so that all the repositories are named as MainRepository-SubRepository. I didn't want to rename all my repositories so modified the regular expression as shown in following example and it works correctly now. This version doesn't require the dash separator in repository name, Main repository and sub repositories can be named independently. The example .hgsub looks like this:

SubFolder1 = SubFolder1
SubFolder2 = SubFolder2
[subpaths]
(https://(?:[^@]+@)?bitbucket\.org/[^/]+)(/[^/]+)/(.*) = \1/\3
like image 94
samirjaiswal Avatar answered Sep 20 '22 00:09

samirjaiswal