sapling/tests/test-treemanifest-fastmanifest.t
Durham Goode 8da9d7b37f treemanifest: automatically download missing trees on demand
Summary:
This adds a remote tree datastore to the store, so if we don't have a tree on
local disk, we can reach out to the server for it.

This also makes a small change to fastmanifest to use get() instead of
getmissing() to test if the tree is available. getmissing() would indicate the
tree is missing if it wasn't local, while get() will attempt to fetch it from
the server.

Test Plan: Added a test

Reviewers: #mercurial, quark

Reviewed By: quark

Subscribers: quark, stash, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4864645

Signature: t1:4864645:1492627823:7afff5db54c895507507e57ab7263f4dbf10b5f7
2017-04-19 21:14:03 -07:00

78 lines
2.1 KiB
Perl

# Integration tests between tree and fastmanifest
$ . "$TESTDIR/library.sh"
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
$ export PYTHONPATH
$ cat >> $TESTTMP/flatcheck.py <<EOF
> import sys, traceback
> from mercurial import extensions, manifest
> def uisetup(ui):
> extensions.wrapfunction(manifest.manifestrevlog, 'revision', readmf)
> def readmf(orig, self, nodeorrev, **kwargs):
> if nodeorrev != -1:
> print >> sys.stderr, 'read flat manifest'
> stack = traceback.extract_stack()
> print >> sys.stderr, ''.join(traceback.format_list(stack[-3:-2]))
> return orig(self, nodeorrev, **kwargs)
> EOF
$ hg init master
$ cd master
$ echo a > a && hg ci -Aqm 'added a'
$ cd ..
$ hg clone -q ssh://user@dummy/master client
$ cd master
$ echo b > b && hg ci -Aqm 'added b'
$ echo c > c && hg ci -Aqm 'added c'
$ cd ..
$ cd client
$ cat >> .hg/hgrc <<EOF
> [extensions]
> fastmanifest=
> flatcheck=$TESTTMP/flatcheck.py
> treemanifest=
>
> [remotefilelog]
> usefastdatapack=True
> reponame=master
>
> [fastmanifest]
> usetree=True
> usecache=True
>
> [treemanifest]
> autocreatetrees=True
> demanddownload=False
> EOF
$ hg pull -q
read flat manifest
File "*fastmanifest/implementation.py", line *, in loadflat (glob)
data = self._revlog.revision(self._node)
# Test checking out from a fastmanifest to a treemanifest uses the treemanifest
$ hg up tip
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo d > d && hg ci -Aqm 'added d'
read flat manifest
File "*fastmanifest/implementation.py", line *, in add (glob)
p1text = origself.revision(p1)
$ hg debugcachemanifest -r .
read flat manifest
File "*fastmanifest/implementation.py", line *, in loadflat (glob)
data = self._revlog.revision(self._node)
$ hg diff -r tip -r 1 --stat
c | 1 -
d | 1 -
2 files changed, 0 insertions(+), 2 deletions(-)
$ hg diff -r 1 -r tip --stat
c | 1 +
d | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)