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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

26,716 views 26 12
Join discussion

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