Can I emulate svn:externals using mercurial?
Asked Answered
W

4

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?

Wheel answered 20/10, 2008 at 4:31 Comment(1)
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?] (#1869540)Cordage
B
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".

Bellina answered 24/10, 2008 at 3:41 Comment(4)
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?Peculiar
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.Bellina
The Nested Repositories feature is further improved in 1.5 I believeGeyer
Yeah, they've even removed the beta warning from the wiki page.Bellina
P
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.

Peculiar answered 13/7, 2009 at 11:20 Comment(0)
B
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".

Bellina answered 24/10, 2008 at 3:41 Comment(4)
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?Peculiar
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.Bellina
The Nested Repositories feature is further improved in 1.5 I believeGeyer
Yeah, they've even removed the beta warning from the wiki page.Bellina
O
3

Have you tried Deps Extension ?

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

Ogden answered 12/5, 2009 at 8:22 Comment(0)
N
0

Try Mercurial's Forest Extension.

Neckar answered 20/10, 2008 at 4:42 Comment(1)
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.Bellina

© 2022 - 2024 — McMap. All rights reserved.