Sub repository not updated properly?

Hello,

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 http://mercurial.selenic.com/wiki/Subrepository#Synchronizing_in_subrepositories.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

650 views 0 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot