views:

243

answers:

2

I am trying to use the subrepo feature of mercurial, using the mercurial eclipse plugin\tortoiseHG.

These are the steps I took:

  1. Created an empty dir /root
  2. cloned all repos that I want to be subrepos inside this folder (/root/sub1, /root/sub2)
  3. Created and added the .hgsub file in the root repo /root/.hgsub and put all the mappings of the sub repos in it
  4. using tortoiseHG, right clicked on /root and selected create repository here
  5. again with tortoise, selected all the files inside /root and added them to to the root repo
  6. commited the root repo
  7. pushed the local root repo into an empty repo I have set up on kiln

Then, I pulled the root repo in eclipse, using import->mercurial.

Now I see that all the subrepos appear as though they are unversioned (no "orange cylinder" icon next to their corresponding folders in the eclipse file explorer).

Furthermore, when I right click on one of the subrepos, I don't get all the hg commands in the "team" menu as I usually get, with root projects - no "pull", "push" etc.

Also, when I made a change to a file in a subrepo, and then "committed" the root project, it told me there were no changes found.

I see the same behavior also in tortoiseHG - When I am browsing files under /root, the files belonging directly to the root repo have an small icon (a V sign) on them marking they are version controlled, while the subrepos' folders aren't marked as such.

What makes me suspect it's some error on my side, is that 1. both tortoise and eclipse do the same thing, so it's less probable to be a bug in either one 2. What they do looks rather sophisticated, so not probable to happen by a bug - they both ignore all folders that are in .hgsub. Had the opposite happened (all subrepos treated as regular folders of the main repo rather than being treated as unversioned), I would have thought it's a bug caused by not treating subrepos. But clearly both apps acknowledge the .hgsub file

Am I doing something wrong, or is it a bug?

+1  A: 

In your first step, did you have actual nested Mercurial repos in the root repo?
Putting a .hgsub with "subdir = subdir" directive is not enough to make subdir a subrepo, if it was just a sub directory of main repo (without any .hg of its own).

As said in the documentation:

Note that the nested repository must actually exist for the line in .hgsub to do anything.
For instance, if rather than creating a local nested repository you attempt to link to a pre-existing remote one, you must ALSO clone that repository:

$ echo nested = https://example.com/nested/repo/path > .hgsub
$ hg add .hgsub
$ hg clone https://example.com/nested/repo/path nested

When in doubt, always try to repeat what you do (up until the push) in a command line, to see what a Hg CLI (command Line Interface) session can show you.
You can experiment on a clone of your current repo to see what went wrong.

Now if you did have nested Hg repos, then there still is the possibility the the plugin "MercurialEclipse" doesn't support yet subRepos.
It doesn't mention subrepos at all in its release notes.
And TortoiseHg only mentions them in its latest 1.0 release.

Support for subrepos in the status/commit tool

VonC
What makes me suspect it's some error on my side, is that 1. both tortoise and eclipse do the same thing, so it's less probable to be a bug in either one 2. What they do looks rather sophisticated, so not probable to happen by a bug - they both ignore all folders that are in .hgsub. Had the opposite happened (all subrepos treated as regular folders of the main repo rather than being treated as unversioned), I would have thought it's a bug caused by not treating subrepos. But clearly both apps acknowledge the .hgsub file
noam
+1  A: 

it is a known bug: http://www.javaforge.com/issue/11871

noam
Good catch. +1 Why TortoiseHg seems to have the same issue though?
VonC