Can I emulate svn:externals using mercurial?

10,020

Solution 1

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".

Solution 2

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.

Solution 3

Have you tried Deps Extension ?

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

Share:
10,020
Eltariel
Author by

Eltariel

I am me. That is all for now.

Updated on June 02, 2022

Comments

  • Eltariel
    Eltariel about 2 years

    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?

  • Ry4an Brase
    Ry4an Brase over 15 years
    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.
  • Nick Pierpoint
    Nick Pierpoint almost 15 years
    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?
  • Ry4an Brase
    Ry4an Brase almost 15 years
    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.
  • Peter Lillevold
    Peter Lillevold about 14 years
    The Nested Repositories feature is further improved in 1.5 I believe
  • Ry4an Brase
    Ry4an Brase about 14 years
    Yeah, they've even removed the beta warning from the wiki page.