views:

75

answers:

2

I'm migrating a set of projects from Subversion to Mercurial. The projects currently use svn:externals to pull code from one into the others. I've been following the recommendation to point externals to a specific revision number and manually update it as needed (so that when I update to a past revision of the main project, I get the past version of the externals too).

The way to do externals in Mercurial seems to be with subrepos, but I don't see a way to peg them to a specific revision - it looks like Hg will always update the subrepos to the latest revision whenever I update the main repo. Is that correct? And is there a way to work around it?

A: 

It does seem that Mercurial subrepos are always updated to the latest tip of the remote repository.

I propose that, if you are using a particular version of a remote repository and updating that version only infrequently, it's better to fold that revision into your main repository. This means you are no longer dependent on the external source for a checkout.

Borealid
+2  A: 

In your .hgsub file you could use the http://[user[:pass]@]host[:port]/[path][#revision] (or local/filesystem/path[#revision]) syntax (see hg help urls for more examples) to anchor the subrepo to a specific revision. For that revision string you could even use #branchname or #tagname so that you track the tip of a specific branch (ex stable) or a moveable tag (ex: release) so that you only get the new version when a branch or tag on the remote subrepo are updated.

Ry4an