Comments
Patch
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1383423584 -3600
# Sat Nov 02 21:19:44 2013 +0100
# Node ID bf750b008cadcff069aca849319cd2083b7adbe3
# Parent eabbdd067b8e2f4c3dc7ba9678b0acb54e1ed710
serve: properly handle cached subrepos
[FIXME] Must _not_ actually recurse into repositories any more, at least if a
subcache is found!
@@ -25,7 +25,8 @@
roothead, roottail = os.path.split(root)
# "foo = /bar/*" or "foo = /bar/**" lets every repo /bar/N in or below
# /bar/ be served as as foo/N .
- # '*' will not search inside dirs with .hg (except .hg/patches),
+ # '*' will not search inside dirs with .hg (except .hg/patches
+ # and .hg/cache/subs),
# '**' will search inside dirs with .hg (and thus also find subrepos).
try:
recurse = {'*': False, '**': True}[roottail]
@@ -46,8 +47,9 @@
>>> conv(urlrepos('', '/opt', ['/opt/r', '/opt/r/r', '/opt']))
[('r', '/opt/r'), ('r/r', '/opt/r/r'), ('', '/opt')]
"""
+ subcache = os.path.normpath('/.hg/cache/subs') + os.path.sep
for path in paths:
- path = os.path.normpath(path)
+ path = os.path.normpath(path).replace(subcache, os.path.sep)
yield (prefix + '/' +
util.pconvert(path[len(roothead):]).lstrip('/')).strip('/'), path
@@ -524,6 +524,12 @@
if recurse:
# avoid recursing inside the .hg directory
dirs.remove('.hg')
+ # except for cached subrepos
+ subcache = os.path.join(root, '.hg', 'cache', 'subs')
+ if os.path.isdir(subcache):
+ for sub in walkrepos(subcache, followsym=followsym,
+ seen_dirs=seen_dirs, recurse=recurse):
+ yield sub
else:
dirs[:] = [] # don't descend further
elif followsym: