##// END OF EJS Templates
bundlespec: move computing the bundle contentops in parsebundlespec...
Boris Feld -
r37182:6c7a6b04 default
parent child Browse files
Show More
@@ -340,9 +340,7 b' def extsetup(ui):'
340 # Make bundle choose changegroup3 instead of changegroup2. This affects
340 # Make bundle choose changegroup3 instead of changegroup2. This affects
341 # "hg bundle" command. Note: it does not cover all bundle formats like
341 # "hg bundle" command. Note: it does not cover all bundle formats like
342 # "packed1". Using "packed1" with lfs will likely cause trouble.
342 # "packed1". Using "packed1" with lfs will likely cause trouble.
343 names = [k for k, v in exchange._bundlespeccgversions.items() if v == '02']
343 exchange._bundlespeccontentopts["v2"]["cg.version"] = "03"
344 for k in names:
345 exchange._bundlespeccgversions[k] = '03'
346
344
347 # bundlerepo uses "vfsmod.readonlyvfs(othervfs)", we need to make sure lfs
345 # bundlerepo uses "vfsmod.readonlyvfs(othervfs)", we need to make sure lfs
348 # options and blob stores are passed from othervfs to the new readonlyvfs.
346 # options and blob stores are passed from othervfs to the new readonlyvfs.
@@ -1596,7 +1596,10 b' def _addpartsfromopts(ui, repo, bundler,'
1596 outgoing.missingheads):
1596 outgoing.missingheads):
1597 part.addparam('targetphase', '%d' % phases.secret, mandatory=False)
1597 part.addparam('targetphase', '%d' % phases.secret, mandatory=False)
1598
1598
1599 if opts.get('tagsfnodescache', True):
1599 addparttagsfnodescache(repo, bundler, outgoing)
1600 addparttagsfnodescache(repo, bundler, outgoing)
1601
1602 if opts.get('revbranchcache', True):
1600 addpartrevbranchcache(repo, bundler, outgoing)
1603 addpartrevbranchcache(repo, bundler, outgoing)
1601
1604
1602 if opts.get('obsolescence', False):
1605 if opts.get('obsolescence', False):
@@ -1204,7 +1204,7 b' def bundle(ui, repo, fname, dest=None, *'
1204 raise error.Abort(pycompat.bytestr(e),
1204 raise error.Abort(pycompat.bytestr(e),
1205 hint=_("see 'hg help bundlespec' for supported "
1205 hint=_("see 'hg help bundlespec' for supported "
1206 "values for --type"))
1206 "values for --type"))
1207 cgversion = bundlespec.version
1207 cgversion = bundlespec.contentopts["cg.version"]
1208
1208
1209 # Packed bundles are a pseudo bundle format for now.
1209 # Packed bundles are a pseudo bundle format for now.
1210 if cgversion == 's1':
1210 if cgversion == 's1':
@@ -1267,14 +1267,15 b' def bundle(ui, repo, fname, dest=None, *'
1267 if complevel is not None:
1267 if complevel is not None:
1268 compopts['level'] = complevel
1268 compopts['level'] = complevel
1269
1269
1270
1270 # Allow overriding the bundling of obsmarker in phases through
1271 contentopts = {'cg.version': cgversion, 'changegroup': True}
1271 # configuration while we don't have a bundle version that include them
1272 if repo.ui.configbool('experimental', 'evolution.bundle-obsmarker'):
1272 if repo.ui.configbool('experimental', 'evolution.bundle-obsmarker'):
1273 contentopts['obsolescence'] = True
1273 bundlespec.contentopts['obsolescence'] = True
1274 if repo.ui.configbool('experimental', 'bundle-phases'):
1274 if repo.ui.configbool('experimental', 'bundle-phases'):
1275 contentopts['phases'] = True
1275 bundlespec.contentopts['phases'] = True
1276
1276 bundle2.writenewbundle(ui, repo, 'bundle', fname, bversion, outgoing,
1277 bundle2.writenewbundle(ui, repo, 'bundle', fname, bversion, outgoing,
1277 contentopts, compression=bcompression,
1278 bundlespec.contentopts, compression=bcompression,
1278 compopts=compopts)
1279 compopts=compopts)
1279
1280
1280 @command('cat',
1281 @command('cat',
@@ -52,6 +52,30 b' urlreq = util.urlreq'
52 'bundle2': '02', #legacy
52 'bundle2': '02', #legacy
53 }
53 }
54
54
55 # Maps bundle version with content opts to choose which part to bundle
56 _bundlespeccontentopts = {
57 'v1': {
58 'changegroup': True,
59 'cg.version': '01',
60 'obsolescence': False,
61 'phases': False,
62 'tagsfnodescache': False,
63 'revbranchcache': False
64 },
65 'v2': {
66 'changegroup': True,
67 'cg.version': '02',
68 'obsolescence': False,
69 'phases': False,
70 'tagsfnodescache': True,
71 'revbranchcache': True
72 },
73 'packed1' : {
74 'cg.version': 's1'
75 }
76 }
77 _bundlespeccontentopts['bundle2'] = _bundlespeccontentopts['v2']
78
55 # Compression engines allowed in version 1. THIS SHOULD NEVER CHANGE.
79 # Compression engines allowed in version 1. THIS SHOULD NEVER CHANGE.
56 _bundlespecv1compengines = {'gzip', 'bzip2', 'none'}
80 _bundlespecv1compengines = {'gzip', 'bzip2', 'none'}
57
81
@@ -60,6 +84,7 b' class bundlespec(object):'
60 compression = attr.ib()
84 compression = attr.ib()
61 version = attr.ib()
85 version = attr.ib()
62 params = attr.ib()
86 params = attr.ib()
87 contentopts = attr.ib()
63
88
64 def parsebundlespec(repo, spec, strict=True, externalnames=False):
89 def parsebundlespec(repo, spec, strict=True, externalnames=False):
65 """Parse a bundle string specification into parts.
90 """Parse a bundle string specification into parts.
@@ -178,12 +203,15 b' def parsebundlespec(repo, spec, strict=T'
178 _('missing support for repository features: %s') %
203 _('missing support for repository features: %s') %
179 ', '.join(sorted(missingreqs)))
204 ', '.join(sorted(missingreqs)))
180
205
206 # Compute contentopts based on the version
207 contentopts = _bundlespeccontentopts.get(version, {}).copy()
208
181 if not externalnames:
209 if not externalnames:
182 engine = util.compengines.forbundlename(compression)
210 engine = util.compengines.forbundlename(compression)
183 compression = engine.bundletype()[1]
211 compression = engine.bundletype()[1]
184 version = _bundlespeccgversions[version]
212 version = _bundlespeccgversions[version]
185
213
186 return bundlespec(compression, version, params)
214 return bundlespec(compression, version, params, contentopts)
187
215
188 def readbundle(ui, fh, fname, vfs=None):
216 def readbundle(ui, fh, fname, vfs=None):
189 header = changegroup.readexactly(fh, 4)
217 header = changegroup.readexactly(fh, 4)
@@ -105,8 +105,8 b' def extsetup(ui):'
105 revlog.REVIDX_FLAGS_ORDER.extend(flags)
105 revlog.REVIDX_FLAGS_ORDER.extend(flags)
106
106
107 # Teach exchange to use changegroup 3
107 # Teach exchange to use changegroup 3
108 for k in exchange._bundlespeccgversions.keys():
108 for k in exchange._bundlespeccontentopts.keys():
109 exchange._bundlespeccgversions[k] = b'03'
109 exchange._bundlespeccontentopts[k]["cg.version"] = "03"
110
110
111 # Add wrappers for addrevision, responsible to set flags depending on the
111 # Add wrappers for addrevision, responsible to set flags depending on the
112 # revision data contents.
112 # revision data contents.
General Comments 0
You need to be logged in to leave comments. Login now