[PATCH] subrepo: look for local pull source first

Mads Kiilerich mads at kiilerich.com
Thu Mar 24 14:34:55 CDT 2011


On 03/24/2011 07:16 PM, Martin Geisler wrote:
> # HG changeset patch
> # User Martin Geisler<mg at aragost.com>
> # Date 1300989966 -3600
> # Node ID 4757320187407df151d680613c991f653ec0c3ec
> # Parent  78a0a815fd41d794550d12428362cd51b261c1c6
> subrepo: look for local pull source first

You really mean local? Why restrict it to local? Why can't the same 
method be used for all paths?

> With this change, a subrepository will always try to find the
> changesets it needs in a repository relative to the pull source of the
> top-most parent repository. So if we have
>
>    repo/
>      sub/
>
> and make a clone with 'hg clone repo clone', then clone/sub will pull
> in changesets from repo/sub, regardless of what the .hgsub file says.

It should be noted explicitly that this is a change of behavior and not 
really a bug fix. It will kick in every time an unknown hg subrepo 
revision is requested and it thus tries to make a pull _and_ the top 
repo happens to have a local default path.

What is the rationale for doing it for hg subrepos only?

FWIW I don't like command line tools that do trial-and-error. It should 
be 100% predictable what a command line tool will do. DWIM is nice when 
it does the right thing, but it also makes it harder to understand and 
learn the tool and find usage errors.

> This will allow you to make clones of repositories where the .hgsub
> file uses 'sub = ../sub' paths. The problem with these repositories is
> that they are structurally different from where they were cloned from.
> By looking for the subrepository in-place, we avoid this problem.
>
> It will also allow you to make clones while offline, even if a
> repository uses subrepositories that are specified with remote URLs.

This will effectively change non-trivial relative paths to trivial 
paths, right? I'm all for deprecating and discouraging use of 
non-trivial and absolute paths, but why should we change the semantics 
of them? Why can't people just start using trivial paths?

Wasn't it the plan that it should be possible to use subpaths to use 
other paths than the ones in .hgsub?

If we want this I think it should be guarded by a command line option. 
But because it will kick in when nobody expects it it would perhaps be 
more convenient with an ugly config setting.

I also wonder if it wouldn't be better to try to do what the subrepo 
config says before we fall back to try other sources.

/Mads


More information about the Mercurial-devel mailing list