2

I'm trying to set up subrepo remapping in Mercurial (2.1.1) to account for subrepo paths that may change in the future. I've been able to get the [subpaths] key to be read and processed properly when it is specified in the .hgrc file. However, when I clone or pull from that repository, the .hgrc file is not copied and thus the subrepo remaps are not brought over to the destination repository.

My first thought after looking at the SubrepoRemappingPlan was to put the [subpaths] in a .hg/subpaths file, which is supposed to be copied on clones/pulls. However, it turns out this functionality has been obsoleted, and the subpaths file has been replaced with a more general configuration-sharing mechanism via the Projrc extension.

The problems with the Projrc solution, though, are:

  1. it's a separate extension that all team members need to have installed and enabled

  2. additional configuration needs to be done to tell Projrc where it is allowed to pull from (and what it is allowed to pull), for security reasons

So, my question is, is there any built-in mechanism in Mercurial for implementing subrepo mapping that is preserved across clones/pulls?

arathorn
  • 2,098
  • 3
  • 20
  • 29

2 Answers2

1

Adding the subpaths mapping to your .hgsub file should do the trick (as described in the mercurial wiki).

CodeFox
  • 3,321
  • 1
  • 29
  • 41
1

Generally, the best method is to use relative paths for subrepos (see http://mercurial.aragost.com/kick-start/en/subrepositories/) so they never have to be remapped at all.

Example:

+ main repo
  + subrepo
  + .hgsub

.hgsub:

subrepo = subrepo
Mark Tolonen
  • 166,664
  • 26
  • 169
  • 251
  • The subrepos in our case are all remote, so we can't use absolute paths in the .hgsub file. – arathorn Mar 28 '12 at 01:27
  • 1
    There is no built-in method, AFAIK. Unfortunately the solutions you've found are the attempts to remedy it. – Mark Tolonen Mar 28 '12 at 03:08
  • @arathorn: even if they are remote, you can still clone them onto your own server and so use relative paths. You then need a cronjob that pulls in new changes to the subrepo clones on your server. – Martin Geisler Mar 28 '12 at 11:08
  • (My comment above should have read: "so we can't use *relative* paths in the .hgsub file.) – arathorn Mar 28 '12 at 13:58