Changing existing subrepo mappings from absolute to relative paths

Angel Ezquerra angel.ezquerra at gmail.com
Thu Dec 15 10:01:56 CST 2011


On Thu, Dec 15, 2011 at 9:27 AM, Martin Geisler <mg at lazybytes.net> wrote:
> Angel Ezquerra <angel.ezquerra at gmail.com> writes:
>
>> Hi,
>>
>> I am in the process of changing the subrepo mappings used in one of
>> our projects from using absolute paths into using relative paths.
>>
>> The original .hgsub file looked as follows:
>>
>> HSPA_MODULES/COMMON = \\mercurial\Mercurial\HSPA\FPGA\COMMON
>>
>> Note that the actual .hgsub file has more than one subrepo mapping,
>> but I've only left one in the example to make this discussion simpler.
>>
>> I started by chaning the .hgsub file into:
>>
>> HSPA_MODULES/COMMON = HSPA_MODULES/COMMON
>>
>> After committing the change on a local clone (let's call it A), I
>> tried to create a new local clone (let's call it B). I was hoping that
>> mercurial would clone the subrepo from the local clone A. Instead I go
>> the message: "cloning subrepo HSPA_MODULES/COMMON from
>> \\mercurial\Mercurial\HSPA\FPGA\COMMON".
>>
>> I was kind of expecting this to happen since the old revisions refer
>> to \\mercurial\Mercurial\HSPA\FPGA\COMMON. Nevertheless it would have
>> made more sense (IMHO) for mercurial to get the subrepo sources from
>> the most recent version of the .hgsub file (or at least try those
>> first).
>>
>> My next attempt was to create an .hg/supaths file with the following
>> contents:
>>
>> [subpaths]
>> \\mercurial\Mercurial\HSPA\FPGA\COMMON = HSPA_MODULES/COMMON
>
> Ah, the .hg/subpaths file is not read by normal Mercurial. It was a file
> read by an early version of the subpaths extension I put on Bitbucket.
> That extension is now called projrc and can set more than just subpaths
> settings.
>
> So you need to do the remapping in a config file actually read by
> Mercurial -- like the .hg/hgrc file.

Martin,

the first Google result for "mercurial subpaths" is
http://mercurial.selenic.com/wiki/SubrepoRemappingPlan, which is where
the usage of the subpaths file is explained. Perhaps it would make
sense to update that wiki page with a link to the new extension?

BTW, I think you had mentioned this projrc extension in the past. I
think it can be very useful, particularly on "corporate" environments
where there is often the need to make sure (to a certain degree) that
all developers have a similar configuration for a given project. I
wish it was distributed with mercurial as an official extension!

Angel


More information about the Mercurial mailing list