[PATCH] serve: automatically include local subrepos

Matt Mackall mpm at selenic.com
Tue Feb 22 11:13:15 CST 2011

On Tue, 2011-02-22 at 09:43 +0000, Mike Williams wrote:

> > Second, this patch doesn't fit in with the subrepo design philosophy.
> > We make a point of NOT looking into changesets to figure out what
> > subrepos are involved when we don't have a working directory context.
> > For starters, there's no reason to think that there will be a uniquely
> > relevant and correct changeset. There could be many on many different
> > branches, and one or more of them could be buggy. Further, there's no
> > reason to think those subrepos will be -Mercurial- subrepos.
> >
> > Thus knowledge of subrepos is strictly in the domain of clients which
> > have working directories.
> I thought I had picked up the working directory but I see now I hadn't 
> sorry.  I also thought I had filtered subrepos to be mercurial ones 
> only, I must not yet understand what subrepo.status() returns.

> > A more acceptable way to do this would be:
> >
> > - make the single-repo mode of hgweb a special case of hgwebdir
> Ok, will need to do more code reading.
> > - add a flag to the hgweb scripts to include recursively include
> > subdirectories by default
> includesubrepos?  would there be an interaction with descend?

You're still thinking in terms of subrepos. As I've explained above,
this is wrong. A server _must be unaware of the whole concept of
subrepos_. This is because subrepos are bound to individual changesets
and not to the history as a whole. Thus the question of "which subrepos
go with this repo" is meaningless in general. You can't answer this
question without looking at ALL the changesets and then you may to get
lots of contradictory answers.

Instead the server should think instead in terms of "trees of
repositories", serving up repo/ and all repositories under it from a
filesystem point of view. Conveniently, hgweb already knows how to do
this when running in its "hgwebdir" mode with the directive "repo =
repo/**". This is more or less what you want, but it's not easy to get
at using hg serve (you need to give it a --web-conf file)

So to fix that, my proposal is:

- make single repo just a special case of directory mode, so that nested
repositories are just a config option away

- add a switch (--recursive) to serve so that we serve nested repos.

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial-devel mailing list