Changing existing subrepo mappings from absolute to relative paths

Angel Ezquerra angel.ezquerra at gmail.com
Thu Dec 15 15:10:08 UTC 2011


On Thu, Dec 15, 2011 at 3:28 PM, Martin Geisler <mg at lazybytes.net> wrote:
> Angel Ezquerra <angel.ezquerra at gmail.com> writes:
>
>> On Wed, Dec 14, 2011 at 7:03 PM, Mads Kiilerich <mads at kiilerich.com> wrote:
>>> On 12/14/2011 12:48 PM, Angel Ezquerra wrote:
>>>>
>>>> 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).
>>>
>>>
>>> Was the new .hgsub committed to the tip of the default branch? 'hg clone -u
>>> branchname A B' might do the right thing.
>>
>> Mads,
>>
>> thank you for your reply. I did not commit the new .hgsub to the tip
>> of the default branch. The developers working on that particular repo
>> "abandonned" the default branch a while ago, and kept working on
>> another branch called "UNIVERSAL" and that is where I changed the
>> .hgsub file.
>>
>> I did a dummy merge with the default branch (since de tip of default
>> was an ancestor of the UNIVERSAL branch) and tried again and now the
>> clone uses the new .hgsub mappings!
>>
>> I was not aware of the rule that subrepo mappings are always taken
>> from the tip of the default branch. Is that the case?
>
> Hmm, yes and no... The .hgsub file is read from the changeset you're
> "dealing" with. So I guess you see it being read from the default branch
> since that's what clone updates to by default.
>
> Does it change if you use 'hg clone -b UNIVERSAL' instead?

It does. When I do that it properly uses the new relative subrepo
paths rather than the old absolute paths.

If I use the --noupdate flag no pulls are performed, and then when I
do an update it pulls from the old or the new sources depending on
where update to.

However, if I do a clone --rev and the revision is a revision on the
UNIVERSAL branch, it still pulls from the old absolute subrepo paths,
which is weird IMHO.

Angel



More information about the Mercurial mailing list