Recursive pull on subrepos

Martin Geisler mg at
Sun Sep 4 07:42:47 CDT 2011

Andreas Reichel <andreas at> writes:

Hi Andreas,

> [...] REPO_A changes only, when adding another SUBREPO. Also I work on
> many SUBREPOs in parallel. So I would like to synchronize all the
> SUBREPOs quite often. While "hg push" works very well, "hg pull" does
> not work recursively. To ease the pain I wrote a script like:
> #!/bin/bash
> while read LINE
> do
> 	DEST=`echo $LINE | cut -d '=' -f 1 | sed 's/^ *//;s/ *$//'`
> 	REPO=`echo $LINE | cut -d '=' -f 2 | sed 's/^ *//;s/ *$//'`
> 	hg pull -u --cwd $DEST $REPO
> done < .hgsub
> and I wonder if this could be integrated into the mercurial directly. I
> understand there are reasons, when you do not like to pull the SUBREPOs
> (well, honestly I do not -- but I can accept of course)

The reason is that it is not known what to pull until you do 'hg
update'. It is only at that point that we know the content of the .hgsub
and .hgsubstate files and so know what revisions to pull and from where.
There are more about this in the archives.

> but please understand there are also situations where you like to pull
> all SUBREPOs and it is a lot of overhead to pull 20 SUBREPOs manually.
> At least any kind of extension would be great!

Use the onsub extension I wrote:

That lets you do 'hg onsub "hg pull -u"' to recursively update all

Martin Geisler

Mercurial links:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the Mercurial-devel mailing list