views:

145

answers:

3

I have a project that is combining multiple hg repositories (different components) to build a single application. I'm looking for a cross-platform tool to support performing an operation on multiple repos at the same time (e.g. tag, pull, push, commit etc...) Essentially, I'm looking for the 'repo' script that Google wrote for Android, but for hg instead of git:

http://source.android.com/download/using-repo

I searched on stack overflow and found this:

http://stackoverflow.com/questions/908452/mercurial-windows-batch-file-for-pulling-changes-to-multiple-repositories

But it's still a bit manual and windows only. I know it's not that hard to write the script to either pass a command to the repos or try to encapsulate everything, but thought that it might be a common thing so maybe others already have a solution. I suppose one approach would be to port the repo script to hg (find and replace git with hg would probably get pretty far for simple operations).

What do other people do in this situation?

+4  A: 

Definitely look at the new (in version 1.3) subrepositories feature in Mercurial. It lets you have an overarching repository that contains other repositories. The state of the top level includes a file that specifies the hash of the tip of the sub-repos, so you can effectively specify a single hash node id that encompasses the state of all the subordinate repos.

http://mercurial.selenic.com/wiki/subrepos

Ry4an
Thanks, I'll definitely keep an eye on it. Don't think I'll be able to restructure our repos to use an "experimental" feature quite yet, so I'll probably invest the 10 minutes in hacking together a quick script.
Brian
+1  A: 

You can use an alternative extension called forest. Although subrepositories will probably supersede this extension in the future, forest has been used for a while by several large projects like Sun's OpenJDK.

Andrey Vlasovskikh
A: 

See http://bitbucket.org/codekoala/hgext/src/tip/README for a multipush and multipull.

Faheem Mitha