##// END OF EJS Templates
stream-clone: support streamv3 on the cli [hg bundle]...
Arseniy Alekseyev -
r51426:f4a540c2 default
parent child Browse files
Show More
@@ -1736,6 +1736,8 b' def writenewbundle('
1736 caps[b'obsmarkers'] = (b'V1',)
1736 caps[b'obsmarkers'] = (b'V1',)
1737 if opts.get(b'streamv2'):
1737 if opts.get(b'streamv2'):
1738 caps[b'stream'] = [b'v2']
1738 caps[b'stream'] = [b'v2']
1739 elif opts.get(b'streamv3-exp'):
1740 caps[b'stream'] = [b'v3-exp']
1739 bundle = bundle20(ui, caps)
1741 bundle = bundle20(ui, caps)
1740 bundle.setcompression(compression, compopts)
1742 bundle.setcompression(compression, compopts)
1741 _addpartsfromopts(ui, repo, bundle, source, outgoing, opts)
1743 _addpartsfromopts(ui, repo, bundle, source, outgoing, opts)
@@ -1781,6 +1783,9 b' def _addpartsfromopts(ui, repo, bundler,'
1781 if opts.get(b'streamv2', False):
1783 if opts.get(b'streamv2', False):
1782 addpartbundlestream2(bundler, repo, stream=True)
1784 addpartbundlestream2(bundler, repo, stream=True)
1783
1785
1786 if opts.get(b'streamv3-exp', False):
1787 addpartbundlestream2(bundler, repo, stream=True)
1788
1784 if opts.get(b'tagsfnodescache', True):
1789 if opts.get(b'tagsfnodescache', True):
1785 addparttagsfnodescache(repo, bundler, outgoing)
1790 addparttagsfnodescache(repo, bundler, outgoing)
1786
1791
@@ -100,6 +100,15 b' class bundlespec:'
100 b'tagsfnodescache': False,
100 b'tagsfnodescache': False,
101 b'revbranchcache': False,
101 b'revbranchcache': False,
102 },
102 },
103 b'streamv3-exp': {
104 b'changegroup': False,
105 b'cg.version': b'03',
106 b'obsolescence': False,
107 b'phases': False,
108 b"streamv3-exp": True,
109 b'tagsfnodescache': False,
110 b'revbranchcache': False,
111 },
103 b'packed1': {
112 b'packed1': {
104 b'cg.version': b's1',
113 b'cg.version': b's1',
105 },
114 },
@@ -278,8 +287,10 b' def parsebundlespec(repo, spec, strict=T'
278 # warning when the old way is encountered)
287 # warning when the old way is encountered)
279 if params[b"stream"] == b"v2":
288 if params[b"stream"] == b"v2":
280 version = b"streamv2"
289 version = b"streamv2"
290 if params[b"stream"] == b"v3-exp":
291 version = b"streamv3-exp"
281 contentopts = _bundlespeccontentopts.get(version, {}).copy()
292 contentopts = _bundlespeccontentopts.get(version, {}).copy()
282 if version == b"streamv2":
293 if version == b"streamv2" or version == b"streamv3-exp":
283 # streamv2 have been reported as "v2" for a while.
294 # streamv2 have been reported as "v2" for a while.
284 version = b"v2"
295 version = b"v2"
285
296
@@ -337,7 +348,10 b' def isstreamclonespec(bundlespec):'
337 if (
348 if (
338 bundlespec.wirecompression == b'UN'
349 bundlespec.wirecompression == b'UN'
339 and bundlespec.wireversion == b'02'
350 and bundlespec.wireversion == b'02'
340 and bundlespec.contentopts.get(b'streamv2')
351 and (
352 bundlespec.contentopts.get(b'streamv2')
353 or bundlespec.contentopts.get(b'streamv3-exp')
354 )
341 ):
355 ):
342 return True
356 return True
343
357
@@ -146,6 +146,12 b' def getbundlespec(ui, fh):'
146 splitted = requirements.split()
146 splitted = requirements.split()
147 params = bundle2._formatrequirementsparams(splitted)
147 params = bundle2._formatrequirementsparams(splitted)
148 return b'none-v2;stream=v2;%s' % params
148 return b'none-v2;stream=v2;%s' % params
149 elif part.type == b'stream3-exp' and version is None:
150 # A stream3 part requires to be part of a v2 bundle
151 requirements = urlreq.unquote(part.params[b'requirements'])
152 splitted = requirements.split()
153 params = bundle2._formatrequirementsparams(splitted)
154 return b'none-v2;stream=v3-exp;%s' % params
149 elif part.type == b'obsmarkers':
155 elif part.type == b'obsmarkers':
150 params[b'obsolescence'] = b'yes'
156 params[b'obsolescence'] = b'yes'
151 if not part.mandatory:
157 if not part.mandatory:
@@ -1,6 +1,21 b''
1 #require no-reposimplestore
1 #require no-reposimplestore
2
2
3 Test creating a consuming stream bundle v2
3 #testcases stream-v2 stream-v3
4
5 #if stream-v2
6 $ bundle_format="streamv2"
7 $ stream_version="v2"
8 #endif
9 #if stream-v3
10 $ bundle_format="streamv3-exp"
11 $ stream_version="v3-exp"
12 $ cat << EOF >> $HGRCPATH
13 > [experimental]
14 > stream-v3=yes
15 > EOF
16 #endif
17
18 Test creating a consuming stream bundle v2 and v3
4
19
5 $ getmainid() {
20 $ getmainid() {
6 > hg -R main log --template '{node}\n' --rev "$1"
21 > hg -R main log --template '{node}\n' --rev "$1"
@@ -42,16 +57,22 b' The extension requires a repo (currently'
42 > A
57 > A
43 > EOF
58 > EOF
44
59
45 $ hg bundle -a --type="none-v2;stream=v2" bundle.hg
60 $ hg bundle -a --type="none-v2;stream=$stream_version" bundle.hg
46 $ hg debugbundle bundle.hg
61 $ hg debugbundle bundle.hg
47 Stream params: {}
62 Stream params: {}
48 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlogv1%2Csparserevlog} (mandatory: True) (no-zstd !)
63 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlogv1%2Csparserevlog} (mandatory: True) (stream-v2 no-zstd !)
49 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (zstd no-rust !)
64 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (stream-v2 zstd no-rust !)
50 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (rust !)
65 stream2 -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (stream-v2 rust !)
66 stream3-exp -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlogv1%2Csparserevlog} (mandatory: True) (stream-v3 no-zstd !)
67 stream3-exp -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (stream-v3 zstd no-rust !)
68 stream3-exp -- {bytecount: 1693, filecount: 11, requirements: generaldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog} (mandatory: True) (stream-v3 rust !)
51 $ hg debugbundle --spec bundle.hg
69 $ hg debugbundle --spec bundle.hg
52 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog (no-zstd !)
70 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog (stream-v2 no-zstd !)
53 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (zstd no-rust !)
71 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (stream-v2 zstd no-rust !)
54 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (rust !)
72 none-v2;stream=v2;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (stream-v2 rust !)
73 none-v2;stream=v3-exp;requirements%3Dgeneraldelta%2Crevlogv1%2Csparserevlog (stream-v3 no-zstd !)
74 none-v2;stream=v3-exp;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (stream-v3 zstd no-rust !)
75 none-v2;stream=v3-exp;requirements%3Dgeneraldelta%2Crevlog-compression-zstd%2Crevlogv1%2Csparserevlog (stream-v3 rust !)
55
76
56 Test that we can apply the bundle as a stream clone bundle
77 Test that we can apply the bundle as a stream clone bundle
57
78
@@ -66,13 +87,14 b' Test that we can apply the bundle as a s'
66 $ cat http.pid >> $DAEMON_PIDS
87 $ cat http.pid >> $DAEMON_PIDS
67
88
68 $ cd ..
89 $ cd ..
69 $ hg clone http://localhost:$HGPORT streamv2-clone-implicit --debug
90 $ hg clone http://localhost:$HGPORT stream-clone-implicit --debug
70 using http://localhost:$HGPORT/
91 using http://localhost:$HGPORT/
71 sending capabilities command
92 sending capabilities command
72 sending clonebundles command
93 sending clonebundles command
73 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
94 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
74 bundle2-input-bundle: with-transaction
95 bundle2-input-bundle: with-transaction
75 bundle2-input-part: "stream2" (params: 3 mandatory) supported
96 bundle2-input-part: "stream2" (params: 3 mandatory) supported (stream-v2 !)
97 bundle2-input-part: "stream3-exp" (params: 3 mandatory) supported (stream-v3 !)
76 applying stream bundle
98 applying stream bundle
77 11 files to transfer, 1.65 KB of data
99 11 files to transfer, 1.65 KB of data
78 starting 4 threads for background file closing (?)
100 starting 4 threads for background file closing (?)
@@ -123,13 +145,14 b' Test that we can apply the bundle as a s'
123 updating the branch cache
145 updating the branch cache
124 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob)
146 (sent 4 HTTP requests and * bytes; received * bytes in responses) (glob)
125
147
126 $ hg clone --stream http://localhost:$HGPORT streamv2-clone-explicit --debug
148 $ hg clone --stream http://localhost:$HGPORT stream-clone-explicit --debug
127 using http://localhost:$HGPORT/
149 using http://localhost:$HGPORT/
128 sending capabilities command
150 sending capabilities command
129 sending clonebundles command
151 sending clonebundles command
130 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
152 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
131 bundle2-input-bundle: with-transaction
153 bundle2-input-bundle: with-transaction
132 bundle2-input-part: "stream2" (params: 3 mandatory) supported
154 bundle2-input-part: "stream2" (params: 3 mandatory) supported (stream-v2 !)
155 bundle2-input-part: "stream3-exp" (params: 3 mandatory) supported (stream-v3 !)
133 applying stream bundle
156 applying stream bundle
134 11 files to transfer, 1.65 KB of data
157 11 files to transfer, 1.65 KB of data
135 starting 4 threads for background file closing (?)
158 starting 4 threads for background file closing (?)
General Comments 0
You need to be logged in to leave comments. Login now