61

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?

Aziz Shaikh
  • 16,245
  • 11
  • 62
  • 79
Eltariel
  • 1,298
  • 1
  • 11
  • 16
  • This question best hg extension might be useful. I asked it, quite specifically, to solve this svn:externals issue. [What are the best and must-have hg / mercurial extensions?] (http://stackoverflow.com/questions/1869040/what-are-the-best-and-must-have-hg-mercurial-extensions) – JJ Rohrer Feb 05 '10 at 15:01

4 Answers4

26

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

https://www.mercurial-scm.org/wiki/Subrepository.

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

Nick Pierpoint
  • 17,641
  • 9
  • 46
  • 74
20

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.

Subrepos are considered a "feature of last resort".

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169
  • 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 Jul 13 '09 at 11:22
  • 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 Brase Jul 13 '09 at 14:22
  • 1
    The Nested Repositories feature is further improved in 1.5 I believe – Peter Lillevold Mar 31 '10 at 10:12
  • Yeah, they've even removed the beta warning from the wiki page. – Ry4an Brase Mar 31 '10 at 16:27
3

Have you tried Deps Extension ?

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

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
yanjost
  • 5,223
  • 2
  • 25
  • 28
0

Try Mercurial's Forest Extension.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
sanxiyn
  • 3,648
  • 1
  • 19
  • 15
  • 5
    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 Brase Oct 24 '08 at 03:35