diff --git a/remotefilelog/__init__.py b/remotefilelog/__init__.py --- a/remotefilelog/__init__.py +++ b/remotefilelog/__init__.py @@ -163,6 +163,8 @@ opts['includepattern'] = '\0'.join(repo.includepattern) if repo.excludepattern: opts['excludepattern'] = '\0'.join(repo.excludepattern) + if repo.ui.configbool("treemanifest", "treeonly"): + opts['noflatmanifest'] = 'True' return remote._callstream('stream_out_shallow', **opts) else: return orig() diff --git a/remotefilelog/remotefilelogserver.py b/remotefilelog/remotefilelogserver.py --- a/remotefilelog/remotefilelogserver.py +++ b/remotefilelog/remotefilelogserver.py @@ -74,6 +74,7 @@ class streamstate(object): match = None shallowremote = False + noflatmf = False state = streamstate() def stream_out_shallow(repo, proto, other): @@ -88,9 +89,11 @@ oldshallow = state.shallowremote oldmatch = state.match + oldnoflatmf = state.noflatmf try: state.shallowremote = True state.match = match.always(repo.root, '') + state.noflatmf = other.get('noflatmanifest') == 'True' if includepattern or excludepattern: state.match = match.match(repo.root, '', None, includepattern, excludepattern) @@ -109,6 +112,7 @@ finally: state.shallowremote = oldshallow state.match = oldmatch + state.noflatmf = oldnoflatmf wireproto.commands['stream_out_shallow'] = (stream_out_shallow, '*') @@ -150,6 +154,8 @@ for x in repo.store.topfiles(): if shallowtrees and x[0][:15] == '00manifesttree.': continue + if state.noflatmf and x[0][:11] == '00manifest.': + continue yield x elif shallowrepo.requirement in repo.requirements: diff --git a/tests/test-treemanifest-treeonly.t b/tests/test-treemanifest-treeonly.t --- a/tests/test-treemanifest-treeonly.t +++ b/tests/test-treemanifest-treeonly.t @@ -16,6 +16,7 @@ > server=True > [remotefilelog] > server=True + > shallowtrees=True > EOF Make local commits on the server @@ -251,10 +252,18 @@ Test peer-to-peer push/pull of tree only commits $ cd .. $ clearcache -# TODO: Test tree only clone - $ hgcloneshallow ssh://user@dummy/master client2 -q + $ hgcloneshallow ssh://user@dummy/master client2 -q --config treemanifest.treeonly=True --config extensions.treemanifest= + 2 trees fetched over * (glob) + 1 trees fetched over * (glob) 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over * (glob) $ cd client2 + $ ls_l .hg/store + -rw-r--r-- 277 00changelog.i + drwxr-xr-x data + -rw-r--r-- 0 undo + -rw-r--r-- 2 undo.backupfiles + -rw-r--r-- 0 undo.phaseroots + $ rm -rf $CACHEDIR $ cp ../client/.hg/hgrc .hg/hgrc # Test pulling from a treeonly peer