mercurialcommittortoisehgmercurial-subrepos

TortoiseHg 4.4 does it work for commiting new items in subrepos?


using: Windows, TortoiseHg 4.4

I have just started looking at Mercurial as a route for version control instead of our (not so) wonderful TFS 2010 system. The idea is to allow more flexible branching using our current project architecture and make merging easier.

I created a sub repo structure similar to the one below:

+Main
  ++SharedProjects
  ++Country1
  ++Country2

(+=repo, ++=subrepo)

This created .hgsub in Main that contains:

SharedProjects = SharedProjects
Country1 = Country1
Country2 = Country2

Looking in the hg Workbench i can see the correct hierarchy of project folders under Main.

The Problem:

When i add a file to the Country1 folder and commit the Main folder, nothing is commited. But if I commit the Country1 (sub) repo it commits just fine.

Obviously this is going to cause problems where multiple subrepos under subrepos exist and it will get very risky commiting changes will be missed.

Not sure if I am trying to do something i shouldn't be or if it just doesn't work and there is a trick to it? Have searched and found quite a few older issues but none of those fixes have worked:

I've tried:


Solution

  • The Problem:

    When i add a file to the Country1 folder and commit the Main folder, nothing is commited. But if I commit the Country1 (sub) repo it commits just fine.

    Obviously this is going to cause problems where multiple subrepos under subrepos exist and it will get very risky commiting changes will be missed.

    Not sure if I am trying to do something i shouldn't be or if it just doesn't work and there is a trick to it?

    This is the way it works.

    Country1.file is reponsibility of repository Country1.

    Main repository is just a set of subrepository versions, where a commit in Main is a link to commits in subrepositories.

    For example, you could have:

    Now, if your files aren't under a subrepository, the commit will be in repository Main.

    I would not recommend using multiple levels of subrepositories. Maybe subrepositories aren't the best way for your project.

    You could have one single repository, and store Country1 in a branch named Country1, then Country2 in the branch named Country2, and so on. One branch for every folder. Then you could merge them all into branch default (the main branch).