views:

115

answers:

1

I have recently switched from Subversion to Mercurial for source control and in doing so have split up one repository into several. I used subrepos to manage the dependencies between repositories. The problem is that pull is not suprepo aware so I have to go into each subrepo and pull changes in order to update a repository. Is there a better way to do this?

A: 

pull is not suprepo aware

hg pull should be subrepo aware, provided it is used with the -u (--update) option.

The hg update should, when it comes to subrepos, take them into account:

Whenever newer Mercurial versions encounter this .hgsubstate file when updating your working directory, they'll attempt to pull the specified subrepos and update them to the appropriate state.

Subrepos may also contain their own subrepos and Mercurial will recurse as necessary.


The OP CoreyD adds:

That has not worked for me.
I create two repos /repo and /sub and I clone sub into repo (/repo/sub).
Then I create an .hgsub file in /repo with this a line like this sub = ../sub and commit it.
When I make changes to /sub and then do an update in /repo /repo/sub is unchanged.
Am I doing something wrong?

That looks about right:
SubRepos or submodules (for Git) are all about referening a precise configuration (changeset ref for hg, or commit ref for Git, as explained in this SO question)

When you change anything outside of /repo, you don't change the .hgsubstate file within /repo recording the exact configuration (changeset reference).
Hence no change at all.

You could rather do your /sub changes directly in /repo/sub, commit them, then commit /repo.
Then, a clone of /repo would have the new configuration.

VonC
That has not worked for me. I create two repos /repo and /sub and I clone sub into repo (/repo/sub). Then I create an .hgsub file in /repo with this a line like this sub = ../sub and commit it. When I make changes to /sub and then do an update in /repo /repo/sub is unchanged. Am I doing something wrong?
CoreyD
@CoreyD: I just completed my answer to better explain why there were no changes on update. The question I refer to in my edited answer (http://stackoverflow.com/questions/1979167/git-submodule-update/1979194#1979194) is about Git, but is still important to read, because the true purpose of a SubRepo/submodule is described there.
VonC