views:

2587

answers:

4

We are considering a move from SVN to Mercurial, and have encountered a stumbling block.

We currently use svn:externals to automatically pull a common set of libraries into the working directory. I can't find support for anything like this in Mercurial.

Is there a way to do this automatically with Mercurial, or do I need to fake it as part of my build process?

A: 

Try Mercurial's Forext Extension.

sanxiyn
Beware of the forest extension. It's not been kept current and only works with older versions of Mercurial. It has fallen out of favor with most of the Mercurial folks, so I don't see it being pulled along in the future.
Ry4an
+9  A: 

There's no good way to do it using mercurial only. The Forest Extension mentioned elsewhere causes more problems that in fixes nowadays. Most folks just use a large repo and include all their components in the repo and then have their build scripts download and use 3rd party libraries -- using maven if they're Java-heads.

Short answer "fake it in your build process".

Update:

In Mercurial 1.3 a new sub repos feature was added. it's like the old forest extension, but started as all new code.

Ry4an
Hi. I'm not clear on "Most folks just use a large repo and include all their components in the repo". How would this work? Assuming you have project1 and project2 that both use component1 and component2, how would you 'checkout' project1 in a single hit using Mercurial?
Nick Pierpoint
Put all of project1, project2, component1, and component2 in a single repo, and check them all out at once. That said, I'm editing my answer to show the new NestedRepositories feature in 1.3.
Ry4an
The Nested Repositories feature is further improved in 1.5 I believe
Peter Lillevold
Yeah, they've even removed the beta warning from the wiki page.
Ry4an
+3  A: 

Have you tried Deps Extension ?

It's not part of Mercurial, but seems to mimic svn:externals feature

yanjost
+10  A: 

It appears that the functionality of the Forest Extension is being implemented into core Mercurial (as of 1.3).

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

Currently marked as "experimental" but perhaps will be the route to handle svn:external -type functionality as of v1.4.

Nick Pierpoint