0

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:

  • adding ./ to the front of each .hgsub path
  • making sure 'recursive' is checked in commit dialog
  • adding 'recurserepos=true' to the mercurial.ini
  • made sure file does commit if i directly commit the sub repo
  • command line commit from Main 'hg commit -S -m "test cmd line commit"' got the result 'nothing changed'
DaveC
  • 63
  • 1
  • 8
  • more information about command line tests. I have created a mainrepo and subrepo (of mainrepo) using the walkthrough in the HG docs (http://mercurial.aragost.com/kick-start/en/subrepositories/) and still can't commit changes that have occurred on a sub level. It looks as if the .hgsubstate file is created with all 00000000's instead of a guid, but i have tried setting different relative paths (./subrepo, ../subrepo) to no avail. so it looks as if thats where the problem lies, but at the moment i am stumped for a solution. – DaveC Feb 07 '17 at 17:12

1 Answers1

0

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:

  • Main 1.0 is just a link to SharedProjects 1.1, Country1 1.2 and Country2 1.5.
  • Then, you could make another commit, where Main 2.0 is SharedProjects 1.99, Country1 1.22 and Country2 2.111.

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).

Marcos Zolnowski
  • 2,751
  • 1
  • 24
  • 29
  • Getting too messy i think for what i wanted.Decided to use GIT in the end it seems a little more like it can handle my requirements (hasn't complained yet anyway!). Thanks. – DaveC Feb 08 '17 at 15:06