Mercurial > hg
comparison tests/test-remotefilelog-bundle2-legacy.t @ 40495:3a333a582d7b
remotefilelog: import pruned-down remotefilelog extension from hg-experimental
This is remotefilelog as of my recent patches for compatibility with
current tip of hg, minus support for old versions of Mercurial and
some FB-specific features like their treemanifest extension and
fetching linkrev data from a patched phabricator. The file extutil.py
moved from hgext3rd to remotefilelog.
This is not yet ready to be landed, consider it a preview for
now. Planned changes include:
* replace lz4 with zstd
* rename some capabilities, requirements and wireproto commands to mark
them as experimental
* consolidate bits of shallowutil with related functions (eg readfile)
I'm certainly open to other (small) changes, but my rough mission is
to land this largely as-is so we can use it as a model of the
functionality we need going forward for lazy-fetching of file contents
from a server.
# no-check-commit because of a few foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D4782
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 27 Sep 2018 13:03:19 -0400 |
parents | |
children | 71b8ad0ef3e0 |
comparison
equal
deleted
inserted
replaced
40494:9aeb9e2d28a7 | 40495:3a333a582d7b |
---|---|
1 $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH | |
2 $ export PYTHONPATH | |
3 | |
4 $ . "$TESTDIR/remotefilelog-library.sh" | |
5 | |
6 generaldelta to generaldelta interactions with bundle2 but legacy clients | |
7 without changegroup2 support | |
8 $ cat > testcg2.py << EOF | |
9 > from mercurial import changegroup, registrar, util | |
10 > import sys | |
11 > cmdtable = {} | |
12 > command = registrar.command(cmdtable) | |
13 > @command('testcg2', norepo=True) | |
14 > def testcg2(ui): | |
15 > if not util.safehasattr(changegroup, 'cg2packer'): | |
16 > sys.exit(80) | |
17 > EOF | |
18 $ cat >> $HGRCPATH << EOF | |
19 > [extensions] | |
20 > testcg2 = $TESTTMP/testcg2.py | |
21 > EOF | |
22 $ hg testcg2 || exit 80 | |
23 | |
24 $ cat > disablecg2.py << EOF | |
25 > from mercurial import changegroup, util, error | |
26 > deleted = False | |
27 > def reposetup(ui, repo): | |
28 > global deleted | |
29 > if deleted: | |
30 > return | |
31 > packermap = changegroup._packermap | |
32 > # protect against future changes | |
33 > if len(packermap) != 3: | |
34 > raise error.Abort('packermap has %d versions, expected 3!' % len(packermap)) | |
35 > for k in ['01', '02', '03']: | |
36 > if not packermap.get(k): | |
37 > raise error.Abort("packermap doesn't have key '%s'!" % k) | |
38 > | |
39 > del packermap['02'] | |
40 > deleted = True | |
41 > EOF | |
42 | |
43 $ hginit master | |
44 $ grep generaldelta master/.hg/requires | |
45 generaldelta | |
46 $ cd master | |
47 preferuncompressed = False so that we can make both generaldelta and non-generaldelta clones | |
48 $ cat >> .hg/hgrc <<EOF | |
49 > [remotefilelog] | |
50 > server=True | |
51 > [experimental] | |
52 > bundle2-exp = True | |
53 > [server] | |
54 > preferuncompressed = False | |
55 > EOF | |
56 $ echo x > x | |
57 $ hg commit -qAm x | |
58 | |
59 $ cd .. | |
60 | |
61 $ hgcloneshallow ssh://user@dummy/master shallow -q --pull --config experimental.bundle2-exp=True | |
62 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) | |
63 $ cd shallow | |
64 $ cat >> .hg/hgrc << EOF | |
65 > [extensions] | |
66 > disablecg2 = $TESTTMP/disablecg2.py | |
67 > EOF | |
68 | |
69 $ cd ../master | |
70 $ echo y > y | |
71 $ hg commit -qAm y | |
72 | |
73 $ cd ../shallow | |
74 $ hg pull -u | |
75 pulling from ssh://user@dummy/master | |
76 searching for changes | |
77 adding changesets | |
78 adding manifests | |
79 adding file changes | |
80 added 1 changesets with 0 changes to 0 files | |
81 new changesets d34c38483be9 | |
82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
83 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) | |
84 | |
85 $ echo a > a | |
86 $ hg commit -qAm a | |
87 $ hg push | |
88 pushing to ssh://user@dummy/master | |
89 searching for changes | |
90 remote: adding changesets | |
91 remote: adding manifests | |
92 remote: adding file changes | |
93 remote: added 1 changesets with 1 changes to 1 files |