开发者

How do I get changes to propagate to all subrepos in Mercurial?

开发者 https://www.devze.com 2022-12-27 17:18 出处:网络
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 re

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消