Cloning locally a repo with subrepos using ../ in .hgsub

Mads Kiilerich mads at kiilerich.com
Sat Jan 29 18:53:54 CST 2011


Mike Williams wrote, On 01/29/2011 03:48 PM:
> On 01/29/11 00:10, Mads Kiilerich wrote:
>> Mike Williams wrote, On 01/28/2011 04:23 PM:
>>> (*) A little bit of experience from experimenting with the subpaths
>>> extension.  The subpath is (currently) as it appears in .hgsub and not
>>> normalised in anyway.  If you have mixture of Windows and unix path
>>> separators present then you will need an entry of:
>>>
>>> ..(\\|/)(.*) = \2
>>
>> That sounds like a bug. Can you provide a full but minimal example that
>> demonstrates the problem?
>
> The following sequence for Windows will reproduce the issue.  This is 
> with hg 1.7.3.
>
> hg init subrepo1
> echo H > subrepo1\file1
> hg add subrepo1
> hg commit -m "Initial sub-repo1 commit." subrepo1
> hg init subrepo2
> echo H > subrepo2\file1
> hg add subrepo2
> hg commit -m "Initial sub-repo2 commit." subrepo2
> hg init repo
> echo W > repo\file2
> hg clone subrepo1 repo\subrepo1
> hg clone subrepo2 repo\subrepo2
> echo subrepo1 = ..\subrepo1 > repo\.hgsub

Hmm. hgsub mapping is not (just) a mapping in the file system but a 
mapping of internal paths (which always uses forward slash). The mapping 
could be used on platforms where \ isn't a directory separator, and it 
will also be used when constructing URLs. I guess that we don't have any 
intentions of supporting \ as path separator in .hgsub - just like 
.hgignore also requires forward slashes. That should perhaps be 
clarified somewhere in the documentation.

> echo subrepo2 = ../subrepo2 >> repo\.hgsub
> hg add repo
> hg commit -m "Initial repo + sub-repos commit." repo
> mkdir clone1-dir
> hg clone repo clone1-dir\repo
> echo [subpaths] > clone1-dir\repo\.hg\subpaths
> echo ../(.*) = \1 >> clone1-dir\repo\.hg\subpaths
> mkdir clone2-dir
> hg clone clone1-dir\repo clone2-dir\repo
>
> For me the final command produces the following output.2:
>
> F:\temp\clonetest>hg clone clone1-dir\repo clone2-dir\repo
> updating to branch default
> pulling subrepo subrepo2 from F:\temp\clonetest\clone1-dir\repo\subrepo2
> requesting all changes
> adding changesets
> adding manifests
> adding file changes
> added 1 changesets with 1 changes to 1 files
> pulling subrepo subrepo1 from 
> F:\temp\clonetest\clone1-dir\repo\..\subrepo1
> abort: repository F:\temp\clonetest\clone1-dir\repo\..\subrepo1 not 
> found!
>
> (Just spotted the "1 changesets with 1 changes to 1 files" which is 
> jarring to read.  Is it policy not to bother with the singular/plural 
> reporting issue?)

Yes. Doing it correctly in all localizations would be too much work and 
complexity and only have very little benefit and cause trouble when 
parsing the output.

/Mads



More information about the Mercurial mailing list