8

I'm using Mercurial for personal use and am conteplating it for some distributed projects as an alternative to SVN for various reasons.

I'm getting comfortable with using it for self contained projects and can see various options for sharing however I haven't yet found any guidance on managing common libraries to be included in multiple projects in a similar manner to that provided by externals in subversion.

The most obvious shared lump of code is error handling and reporting - we want this to be pretty much the same in all projects (its fairly well evolved). There is also utility code, control libraries and similar that we find better to have as projects built with each solution than to pull in as compiled classes (not least because it ensures they are kept up to date, continuous integration helps us address breaking changes).

Thoughts (I hate open ended questions, but I want to know what, if anything, others are doing).

Murph
  • 9,985
  • 2
  • 26
  • 41

4 Answers4

3

Mercurial 1.3 now includes nested repository support, which can be used to express dependencies. The other option is to let your build system handle the download and tracking of dependencies using something like ivy or maven though those are more focused on pulling down compiled code.

Ry4an Brase
  • 78,112
  • 7
  • 148
  • 169
1

The world has changed since I asked that question and the solution I now use is different.

The simple answer is now to use packages (specifically NuGet as I do .NET) to deliver the common code instead of nesting repos and including the projects in a solution.

So I have common code built into NuGet packages by and hosted using TeamCity and where previously I would have an external and include the project/source I would now just reference the package.

Murph
  • 9,985
  • 2
  • 26
  • 41
0

Subrepository (with good guide) or Guestrepo "to overcome ... limitations" (of subrepos) is today's language-agnostic answer

Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
0

Use the Forest Extension it emulates svn externals for HG, to some extent that is.

ismail
  • 46,010
  • 9
  • 86
  • 95
  • Thanks, will take a look (its not exactly what I read it as doing, but for that reason I haven't yet read enough...) – Murph May 07 '09 at 07:59
  • 3
    The Forrest Extension was never supported offically, and is now complely obviated by the sub-module support in Mercurial 1.3. – Ry4an Brase Jul 10 '09 at 18:25
  • 3
    And thats a reason to downmod me? The time I wrote the answer there was no Mercurial 1.3. *sigh* – ismail Jul 12 '09 at 09:43
  • It's not downmodding you; it's downmodding the answer. It doesn't even reduce your reputation. Stackoverflow is supposed to produce living documents, where what was the best answer dips if it no longer is. That said, I've always found ForestExtension to be bad advice (though certainly well intended). – Ry4an Brase Jul 16 '09 at 22:23