Sub repository not updated properly?


I've created on Bitbukect a main repository named mainrepo and two other repositories named subrepo1 and subrepo2. As their names suggest there are sub-repositories of mainrepo.

I've defined a .hgsub file with specifies "subrepo1 = ../subrepo1" and "subrepo2 = ../subrepo2". I've also commited few files within these subrepo.

When I clone the mainrepo on a local folder I then obtain the correct structure with the two sub-repo nested within the local copy. I did also some changes in the code files and commit/push back either from mainrepo, subrepo1 or subrepo2. That is working fine. Bitbucket shows the actual changes.

Now, I decided to clone the subrepo2 into another completely different folder, made some changes on files and commit/push them back to bitbucket. I can see the commits and changes on Bitbucket but the problem is the following, within TortoiseHg Workbench:

- If I do an update from mainrepo, nothing is updated in the subrepo2, **the changes actually present in the files are not udpated in the local copy**.
- If I do this update from subrepo2, then the changes are properly applied to the local copy.

Is there something I did wrong or is there a bug/limitation of bitbucket sub-repository feature?

1 answer

1 accepted

0 votes
Accepted answer

This is not a limitation of Bitbucket, rather it is how Mercurial is designed. A 'main' repo tracks the subrepositories at a specific revision. Doing a pull on the main repo will have no effect on the subrepos as the .hgsub file indicates what revision to track against the subrepos. You'd need to cd to the subrepo directory and run hg pull and then hg update to get the subrepository updated.

For more information about how Mercurial subrepositories function, see

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

1,953 views 7 10
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you