Show More
@@ -1,93 +1,93 b'' | |||||
1 | $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH |
|
1 | $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH | |
2 | $ export PYTHONPATH |
|
2 | $ export PYTHONPATH | |
3 |
|
3 | |||
4 | $ . "$TESTDIR/remotefilelog-library.sh" |
|
4 | $ . "$TESTDIR/remotefilelog-library.sh" | |
5 |
|
5 | |||
6 | generaldelta to generaldelta interactions with bundle2 but legacy clients |
|
6 | generaldelta to generaldelta interactions with bundle2 but legacy clients | |
7 | without changegroup2 support |
|
7 | without changegroup2 support | |
8 | $ cat > testcg2.py << EOF |
|
8 | $ cat > testcg2.py << EOF | |
|
9 | > import sys | |||
9 | > from mercurial import changegroup, registrar, util |
|
10 | > from mercurial import changegroup, registrar, util | |
10 | > import sys |
|
|||
11 | > cmdtable = {} |
|
11 | > cmdtable = {} | |
12 | > command = registrar.command(cmdtable) |
|
12 | > command = registrar.command(cmdtable) | |
13 | > @command('testcg2', norepo=True) |
|
13 | > @command('testcg2', norepo=True) | |
14 | > def testcg2(ui): |
|
14 | > def testcg2(ui): | |
15 | > if not util.safehasattr(changegroup, 'cg2packer'): |
|
15 | > if not util.safehasattr(changegroup, 'cg2packer'): | |
16 | > sys.exit(80) |
|
16 | > sys.exit(80) | |
17 | > EOF |
|
17 | > EOF | |
18 | $ cat >> $HGRCPATH << EOF |
|
18 | $ cat >> $HGRCPATH << EOF | |
19 | > [extensions] |
|
19 | > [extensions] | |
20 | > testcg2 = $TESTTMP/testcg2.py |
|
20 | > testcg2 = $TESTTMP/testcg2.py | |
21 | > EOF |
|
21 | > EOF | |
22 | $ hg testcg2 || exit 80 |
|
22 | $ hg testcg2 || exit 80 | |
23 |
|
23 | |||
24 | $ cat > disablecg2.py << EOF |
|
24 | $ cat > disablecg2.py << EOF | |
25 |
> from mercurial import changegroup, |
|
25 | > from mercurial import changegroup, error, util | |
26 | > deleted = False |
|
26 | > deleted = False | |
27 | > def reposetup(ui, repo): |
|
27 | > def reposetup(ui, repo): | |
28 | > global deleted |
|
28 | > global deleted | |
29 | > if deleted: |
|
29 | > if deleted: | |
30 | > return |
|
30 | > return | |
31 | > packermap = changegroup._packermap |
|
31 | > packermap = changegroup._packermap | |
32 | > # protect against future changes |
|
32 | > # protect against future changes | |
33 | > if len(packermap) != 3: |
|
33 | > if len(packermap) != 3: | |
34 | > raise error.Abort('packermap has %d versions, expected 3!' % len(packermap)) |
|
34 | > raise error.Abort('packermap has %d versions, expected 3!' % len(packermap)) | |
35 | > for k in ['01', '02', '03']: |
|
35 | > for k in ['01', '02', '03']: | |
36 | > if not packermap.get(k): |
|
36 | > if not packermap.get(k): | |
37 | > raise error.Abort("packermap doesn't have key '%s'!" % k) |
|
37 | > raise error.Abort("packermap doesn't have key '%s'!" % k) | |
38 | > |
|
38 | > | |
39 | > del packermap['02'] |
|
39 | > del packermap['02'] | |
40 | > deleted = True |
|
40 | > deleted = True | |
41 | > EOF |
|
41 | > EOF | |
42 |
|
42 | |||
43 | $ hginit master |
|
43 | $ hginit master | |
44 | $ grep generaldelta master/.hg/requires |
|
44 | $ grep generaldelta master/.hg/requires | |
45 | generaldelta |
|
45 | generaldelta | |
46 | $ cd master |
|
46 | $ cd master | |
47 | preferuncompressed = False so that we can make both generaldelta and non-generaldelta clones |
|
47 | preferuncompressed = False so that we can make both generaldelta and non-generaldelta clones | |
48 | $ cat >> .hg/hgrc <<EOF |
|
48 | $ cat >> .hg/hgrc <<EOF | |
49 | > [remotefilelog] |
|
49 | > [remotefilelog] | |
50 | > server=True |
|
50 | > server=True | |
51 | > [experimental] |
|
51 | > [experimental] | |
52 | > bundle2-exp = True |
|
52 | > bundle2-exp = True | |
53 | > [server] |
|
53 | > [server] | |
54 | > preferuncompressed = False |
|
54 | > preferuncompressed = False | |
55 | > EOF |
|
55 | > EOF | |
56 | $ echo x > x |
|
56 | $ echo x > x | |
57 | $ hg commit -qAm x |
|
57 | $ hg commit -qAm x | |
58 |
|
58 | |||
59 | $ cd .. |
|
59 | $ cd .. | |
60 |
|
60 | |||
61 | $ hgcloneshallow ssh://user@dummy/master shallow -q --pull --config experimental.bundle2-exp=True |
|
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) |
|
62 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) | |
63 | $ cd shallow |
|
63 | $ cd shallow | |
64 | $ cat >> .hg/hgrc << EOF |
|
64 | $ cat >> .hg/hgrc << EOF | |
65 | > [extensions] |
|
65 | > [extensions] | |
66 | > disablecg2 = $TESTTMP/disablecg2.py |
|
66 | > disablecg2 = $TESTTMP/disablecg2.py | |
67 | > EOF |
|
67 | > EOF | |
68 |
|
68 | |||
69 | $ cd ../master |
|
69 | $ cd ../master | |
70 | $ echo y > y |
|
70 | $ echo y > y | |
71 | $ hg commit -qAm y |
|
71 | $ hg commit -qAm y | |
72 |
|
72 | |||
73 | $ cd ../shallow |
|
73 | $ cd ../shallow | |
74 | $ hg pull -u |
|
74 | $ hg pull -u | |
75 | pulling from ssh://user@dummy/master |
|
75 | pulling from ssh://user@dummy/master | |
76 | searching for changes |
|
76 | searching for changes | |
77 | adding changesets |
|
77 | adding changesets | |
78 | adding manifests |
|
78 | adding manifests | |
79 | adding file changes |
|
79 | adding file changes | |
80 | added 1 changesets with 0 changes to 0 files |
|
80 | added 1 changesets with 0 changes to 0 files | |
81 | new changesets d34c38483be9 |
|
81 | new changesets d34c38483be9 | |
82 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
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) |
|
83 | 1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) | |
84 |
|
84 | |||
85 | $ echo a > a |
|
85 | $ echo a > a | |
86 | $ hg commit -qAm a |
|
86 | $ hg commit -qAm a | |
87 | $ hg push |
|
87 | $ hg push | |
88 | pushing to ssh://user@dummy/master |
|
88 | pushing to ssh://user@dummy/master | |
89 | searching for changes |
|
89 | searching for changes | |
90 | remote: adding changesets |
|
90 | remote: adding changesets | |
91 | remote: adding manifests |
|
91 | remote: adding manifests | |
92 | remote: adding file changes |
|
92 | remote: adding file changes | |
93 | remote: added 1 changesets with 1 changes to 1 files |
|
93 | remote: added 1 changesets with 1 changes to 1 files |
@@ -1,122 +1,124 b'' | |||||
1 | $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH |
|
1 | $ PYTHONPATH=$TESTDIR/..:$PYTHONPATH | |
2 | $ export PYTHONPATH |
|
2 | $ export PYTHONPATH | |
3 |
|
3 | |||
4 | $ . "$TESTDIR/remotefilelog-library.sh" |
|
4 | $ . "$TESTDIR/remotefilelog-library.sh" | |
5 |
|
5 | |||
6 | $ hg init repo |
|
6 | $ hg init repo | |
7 | $ cd repo |
|
7 | $ cd repo | |
8 | $ cat >> .hg/hgrc <<EOF |
|
8 | $ cat >> .hg/hgrc <<EOF | |
9 | > [remotefilelog] |
|
9 | > [remotefilelog] | |
10 | > server=True |
|
10 | > server=True | |
11 | > EOF |
|
11 | > EOF | |
12 | $ echo x > x |
|
12 | $ echo x > x | |
13 | $ echo y > y |
|
13 | $ echo y > y | |
14 | $ echo z > z |
|
14 | $ echo z > z | |
15 | $ hg commit -qAm xy |
|
15 | $ hg commit -qAm xy | |
16 | $ cd .. |
|
16 | $ cd .. | |
17 |
|
17 | |||
18 | $ cat > cacheprocess-logger.py <<EOF |
|
18 | $ cat > cacheprocess-logger.py <<EOF | |
19 |
> import |
|
19 | > import os | |
|
20 | > import shutil | |||
|
21 | > import sys | |||
20 | > f = open('$TESTTMP/cachelog.log', 'w') |
|
22 | > f = open('$TESTTMP/cachelog.log', 'w') | |
21 | > srccache = os.path.join('$TESTTMP', 'oldhgcache') |
|
23 | > srccache = os.path.join('$TESTTMP', 'oldhgcache') | |
22 | > def log(message): |
|
24 | > def log(message): | |
23 | > f.write(message) |
|
25 | > f.write(message) | |
24 | > f.flush() |
|
26 | > f.flush() | |
25 | > destcache = sys.argv[-1] |
|
27 | > destcache = sys.argv[-1] | |
26 | > try: |
|
28 | > try: | |
27 | > while True: |
|
29 | > while True: | |
28 | > cmd = sys.stdin.readline().strip() |
|
30 | > cmd = sys.stdin.readline().strip() | |
29 | > log('got command %r\n' % cmd) |
|
31 | > log('got command %r\n' % cmd) | |
30 | > if cmd == 'exit': |
|
32 | > if cmd == 'exit': | |
31 | > sys.exit(0) |
|
33 | > sys.exit(0) | |
32 | > elif cmd == 'get': |
|
34 | > elif cmd == 'get': | |
33 | > count = int(sys.stdin.readline()) |
|
35 | > count = int(sys.stdin.readline()) | |
34 | > log('client wants %r blobs\n' % count) |
|
36 | > log('client wants %r blobs\n' % count) | |
35 | > wants = [] |
|
37 | > wants = [] | |
36 | > for _ in xrange(count): |
|
38 | > for _ in xrange(count): | |
37 | > key = sys.stdin.readline()[:-1] |
|
39 | > key = sys.stdin.readline()[:-1] | |
38 | > wants.append(key) |
|
40 | > wants.append(key) | |
39 | > if '\0' in key: |
|
41 | > if '\0' in key: | |
40 | > _, key = key.split('\0') |
|
42 | > _, key = key.split('\0') | |
41 | > srcpath = os.path.join(srccache, key) |
|
43 | > srcpath = os.path.join(srccache, key) | |
42 | > if os.path.exists(srcpath): |
|
44 | > if os.path.exists(srcpath): | |
43 | > dest = os.path.join(destcache, key) |
|
45 | > dest = os.path.join(destcache, key) | |
44 | > destdir = os.path.dirname(dest) |
|
46 | > destdir = os.path.dirname(dest) | |
45 | > if not os.path.exists(destdir): |
|
47 | > if not os.path.exists(destdir): | |
46 | > os.makedirs(destdir) |
|
48 | > os.makedirs(destdir) | |
47 | > shutil.copyfile(srcpath, dest) |
|
49 | > shutil.copyfile(srcpath, dest) | |
48 | > else: |
|
50 | > else: | |
49 | > # report a cache miss |
|
51 | > # report a cache miss | |
50 | > sys.stdout.write(key + '\n') |
|
52 | > sys.stdout.write(key + '\n') | |
51 | > sys.stdout.write('0\n') |
|
53 | > sys.stdout.write('0\n') | |
52 | > for key in sorted(wants): |
|
54 | > for key in sorted(wants): | |
53 | > log('requested %r\n' % key) |
|
55 | > log('requested %r\n' % key) | |
54 | > sys.stdout.flush() |
|
56 | > sys.stdout.flush() | |
55 | > elif cmd == 'set': |
|
57 | > elif cmd == 'set': | |
56 | > assert False, 'todo writing' |
|
58 | > assert False, 'todo writing' | |
57 | > else: |
|
59 | > else: | |
58 | > assert False, 'unknown command! %r' % cmd |
|
60 | > assert False, 'unknown command! %r' % cmd | |
59 | > except Exception as e: |
|
61 | > except Exception as e: | |
60 | > log('Exception! %r\n' % e) |
|
62 | > log('Exception! %r\n' % e) | |
61 | > raise |
|
63 | > raise | |
62 | > EOF |
|
64 | > EOF | |
63 |
|
65 | |||
64 | $ cat >> $HGRCPATH <<EOF |
|
66 | $ cat >> $HGRCPATH <<EOF | |
65 | > [remotefilelog] |
|
67 | > [remotefilelog] | |
66 | > cacheprocess = python $TESTTMP/cacheprocess-logger.py |
|
68 | > cacheprocess = python $TESTTMP/cacheprocess-logger.py | |
67 | > EOF |
|
69 | > EOF | |
68 |
|
70 | |||
69 | Test cache keys and cache misses. |
|
71 | Test cache keys and cache misses. | |
70 | $ hgcloneshallow ssh://user@dummy/repo clone -q |
|
72 | $ hgcloneshallow ssh://user@dummy/repo clone -q | |
71 | 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob) |
|
73 | 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob) | |
72 | $ cat cachelog.log |
|
74 | $ cat cachelog.log | |
73 | got command 'get' |
|
75 | got command 'get' | |
74 | client wants 3 blobs |
|
76 | client wants 3 blobs | |
75 | requested 'master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0' |
|
77 | requested 'master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0' | |
76 | requested 'master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a' |
|
78 | requested 'master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a' | |
77 | requested 'master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca' |
|
79 | requested 'master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca' | |
78 | got command 'set' |
|
80 | got command 'set' | |
79 | Exception! AssertionError('todo writing',) |
|
81 | Exception! AssertionError('todo writing',) | |
80 |
|
82 | |||
81 | Test cache hits. |
|
83 | Test cache hits. | |
82 | $ mv hgcache oldhgcache |
|
84 | $ mv hgcache oldhgcache | |
83 | $ rm cachelog.log |
|
85 | $ rm cachelog.log | |
84 | $ hgcloneshallow ssh://user@dummy/repo clone-cachehit -q |
|
86 | $ hgcloneshallow ssh://user@dummy/repo clone-cachehit -q | |
85 | 3 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over *s (glob) |
|
87 | 3 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over *s (glob) | |
86 | $ cat cachelog.log | grep -v exit |
|
88 | $ cat cachelog.log | grep -v exit | |
87 | got command 'get' |
|
89 | got command 'get' | |
88 | client wants 3 blobs |
|
90 | client wants 3 blobs | |
89 | requested 'master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0' |
|
91 | requested 'master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0' | |
90 | requested 'master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a' |
|
92 | requested 'master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a' | |
91 | requested 'master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca' |
|
93 | requested 'master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca' | |
92 |
|
94 | |||
93 | $ cat >> $HGRCPATH <<EOF |
|
95 | $ cat >> $HGRCPATH <<EOF | |
94 | > [remotefilelog] |
|
96 | > [remotefilelog] | |
95 | > cacheprocess.includepath = yes |
|
97 | > cacheprocess.includepath = yes | |
96 | > EOF |
|
98 | > EOF | |
97 |
|
99 | |||
98 | Test cache keys and cache misses with includepath. |
|
100 | Test cache keys and cache misses with includepath. | |
99 | $ rm -r hgcache oldhgcache |
|
101 | $ rm -r hgcache oldhgcache | |
100 | $ rm cachelog.log |
|
102 | $ rm cachelog.log | |
101 | $ hgcloneshallow ssh://user@dummy/repo clone-withpath -q |
|
103 | $ hgcloneshallow ssh://user@dummy/repo clone-withpath -q | |
102 | 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob) |
|
104 | 3 files fetched over 1 fetches - (3 misses, 0.00% hit ratio) over *s (glob) | |
103 | $ cat cachelog.log |
|
105 | $ cat cachelog.log | |
104 | got command 'get' |
|
106 | got command 'get' | |
105 | client wants 3 blobs |
|
107 | client wants 3 blobs | |
106 | requested 'x\x00master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0' |
|
108 | requested 'x\x00master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0' | |
107 | requested 'y\x00master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca' |
|
109 | requested 'y\x00master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca' | |
108 | requested 'z\x00master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a' |
|
110 | requested 'z\x00master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a' | |
109 | got command 'set' |
|
111 | got command 'set' | |
110 | Exception! AssertionError('todo writing',) |
|
112 | Exception! AssertionError('todo writing',) | |
111 |
|
113 | |||
112 | Test cache hits with includepath. |
|
114 | Test cache hits with includepath. | |
113 | $ mv hgcache oldhgcache |
|
115 | $ mv hgcache oldhgcache | |
114 | $ rm cachelog.log |
|
116 | $ rm cachelog.log | |
115 | $ hgcloneshallow ssh://user@dummy/repo clone-withpath-cachehit -q |
|
117 | $ hgcloneshallow ssh://user@dummy/repo clone-withpath-cachehit -q | |
116 | 3 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over *s (glob) |
|
118 | 3 files fetched over 1 fetches - (0 misses, 100.00% hit ratio) over *s (glob) | |
117 | $ cat cachelog.log | grep -v exit |
|
119 | $ cat cachelog.log | grep -v exit | |
118 | got command 'get' |
|
120 | got command 'get' | |
119 | client wants 3 blobs |
|
121 | client wants 3 blobs | |
120 | requested 'x\x00master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0' |
|
122 | requested 'x\x00master/11/f6ad8ec52a2984abaafd7c3b516503785c2072/1406e74118627694268417491f018a4a883152f0' | |
121 | requested 'y\x00master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca' |
|
123 | requested 'y\x00master/95/cb0bfd2977c761298d9624e4b4d4c72a39974a/076f5e2225b3ff0400b98c92aa6cdf403ee24cca' | |
122 | requested 'z\x00master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a' |
|
124 | requested 'z\x00master/39/5df8f7c51f007019cb30201c49e884b46b92fa/69a1b67522704ec122181c0890bd16e9d3e7516a' |
General Comments 0
You need to be logged in to leave comments.
Login now