Mercurial > hg-stable
diff tests/test-subrepo-deep-nested-change.t @ 32005:2406dbba49bd
serve: add support for Mercurial subrepositories
I've been using `hg serve --web-conf ...` with a simple '/=projects/**' [paths]
configuration for awhile without issue. Let's ditch the need for the manual
configuration in this case, and limit the repos served to the actual subrepos.
This doesn't attempt to handle the case where a new subrepo appears while the
server is running. That could probably be handled with a hook if somebody wants
it. But it's such a rare case, it probably doesn't matter for the temporary
serves.
The main repo is served at '/', just like a repository without subrepos. I'm
not sure why the duplicate 'adding ...' lines appear on Linux. They don't
appear on Windows (see 594dd384803c), so they are optional.
Subrepositories that are configured with '../path' or absolute paths are not
cloneable from the server. (They aren't cloneable locally either, unless they
also exist at their configured source, perhaps via the share extension.) They
are still served, so that they can be browsed, or cloned individually. If we
care about that cloning someday, we can probably just add the extra entries to
the webconf dictionary. Even if the entries use '../' to escape the root, only
the related subrepositories would end up in the dictionary.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 15 Apr 2017 18:05:40 -0400 |
parents | 4431add9aef9 |
children | 3047167733dc |
line wrap: on
line diff
--- a/tests/test-subrepo-deep-nested-change.t Fri Mar 31 23:00:41 2017 -0400 +++ b/tests/test-subrepo-deep-nested-change.t Sat Apr 15 18:05:40 2017 -0400 @@ -73,6 +73,43 @@ adding main/main (glob) $ hg commit -R main -m "main import" +#if serve + +Unfortunately, subrepos not at their nominal location cannot be cloned. But +they are still served from their location within the local repository. The only +reason why 'main' can be cloned via the filesystem is because 'sub1' and 'sub2' +are also available as siblings of 'main'. + + $ hg serve -R main --debug -S -p $HGPORT -d --pid-file=hg1.pid -E error.log -A access.log + adding = $TESTTMP/main (glob) + adding sub1 = $TESTTMP/main/sub1 (glob) + adding sub1/sub2 = $TESTTMP/main/sub1/sub2 (glob) + listening at http://*:$HGPORT/ (bound to *:$HGPORT) (glob) (?) + adding = $TESTTMP/main (glob) (?) + adding sub1 = $TESTTMP/main/sub1 (glob) (?) + adding sub1/sub2 = $TESTTMP/main/sub1/sub2 (glob) (?) + $ cat hg1.pid >> $DAEMON_PIDS + + $ hg clone http://localhost:$HGPORT httpclone --config progress.disable=True + requesting all changes + adding changesets + adding manifests + adding file changes + added 1 changesets with 3 changes to 3 files + updating to branch default + abort: HTTP Error 404: Not Found + [255] + + $ cat access.log + * "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) + * "GET /?cmd=batch HTTP/1.1" 200 - * (glob) + * "GET /?cmd=getbundle HTTP/1.1" 200 - * (glob) + * "GET /../sub1?cmd=capabilities HTTP/1.1" 404 - (glob) + + $ killdaemons.py + $ rm hg1.pid error.log access.log +#endif + Cleaning both repositories, just as a clone -U $ hg up -C -R sub2 null