Show More
@@ -1596,6 +1596,9 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('streamv2', False): | |||
|
1600 | addpartbundlestream2(bundler, repo, stream=True) | |||
|
1601 | ||||
1599 | if opts.get('tagsfnodescache', True): |
|
1602 | if opts.get('tagsfnodescache', True): | |
1600 | addparttagsfnodescache(repo, bundler, outgoing) |
|
1603 | addparttagsfnodescache(repo, bundler, outgoing) | |
1601 |
|
1604 | |||
@@ -1657,6 +1660,37 b' def addpartrevbranchcache(repo, bundler,' | |||||
1657 |
|
1660 | |||
1658 | bundler.newpart('cache:rev-branch-cache', data=generate()) |
|
1661 | bundler.newpart('cache:rev-branch-cache', data=generate()) | |
1659 |
|
1662 | |||
|
1663 | def _formatrequirementsspec(requirements): | |||
|
1664 | return urlreq.quote(','.join(sorted(requirements))) | |||
|
1665 | ||||
|
1666 | def _formatrequirementsparams(requirements): | |||
|
1667 | requirements = _formatrequirementsspec(requirements) | |||
|
1668 | params = "%s%s" % (urlreq.quote("requirements="), requirements) | |||
|
1669 | return params | |||
|
1670 | ||||
|
1671 | def addpartbundlestream2(bundler, repo, **kwargs): | |||
|
1672 | if not kwargs.get('stream', False): | |||
|
1673 | return | |||
|
1674 | ||||
|
1675 | if not streamclone.allowservergeneration(repo): | |||
|
1676 | raise error.Abort(_('stream data requested but server does not allow ' | |||
|
1677 | 'this feature'), | |||
|
1678 | hint=_('well-behaved clients should not be ' | |||
|
1679 | 'requesting stream data from servers not ' | |||
|
1680 | 'advertising it; the client may be buggy')) | |||
|
1681 | ||||
|
1682 | # Stream clones don't compress well. And compression undermines a | |||
|
1683 | # goal of stream clones, which is to be fast. Communicate the desire | |||
|
1684 | # to avoid compression to consumers of the bundle. | |||
|
1685 | bundler.prefercompressed = False | |||
|
1686 | ||||
|
1687 | filecount, bytecount, it = streamclone.generatev2(repo) | |||
|
1688 | requirements = _formatrequirementsspec(repo.requirements) | |||
|
1689 | part = bundler.newpart('stream2', data=it) | |||
|
1690 | part.addparam('bytecount', '%d' % bytecount, mandatory=True) | |||
|
1691 | part.addparam('filecount', '%d' % filecount, mandatory=True) | |||
|
1692 | part.addparam('requirements', requirements, mandatory=True) | |||
|
1693 | ||||
1660 | def buildobsmarkerspart(bundler, markers): |
|
1694 | def buildobsmarkerspart(bundler, markers): | |
1661 | """add an obsmarker part to the bundler with <markers> |
|
1695 | """add an obsmarker part to the bundler with <markers> | |
1662 |
|
1696 |
@@ -241,14 +241,6 b' def readbundle(ui, fh, fname, vfs=None):' | |||||
241 | else: |
|
241 | else: | |
242 | raise error.Abort(_('%s: unknown bundle version %s') % (fname, version)) |
|
242 | raise error.Abort(_('%s: unknown bundle version %s') % (fname, version)) | |
243 |
|
243 | |||
244 | def _formatrequirementsspec(requirements): |
|
|||
245 | return urlreq.quote(','.join(sorted(requirements))) |
|
|||
246 |
|
||||
247 | def _formatrequirementsparams(requirements): |
|
|||
248 | requirements = _formatrequirementsspec(requirements) |
|
|||
249 | params = "%s%s" % (urlreq.quote("requirements="), requirements) |
|
|||
250 | return params |
|
|||
251 |
|
||||
252 | def getbundlespec(ui, fh): |
|
244 | def getbundlespec(ui, fh): | |
253 | """Infer the bundlespec from a bundle file handle. |
|
245 | """Infer the bundlespec from a bundle file handle. | |
254 |
|
246 | |||
@@ -297,7 +289,8 b' def getbundlespec(ui, fh):' | |||||
297 | return '%s-%s' % (comp, version) |
|
289 | return '%s-%s' % (comp, version) | |
298 | elif isinstance(b, streamclone.streamcloneapplier): |
|
290 | elif isinstance(b, streamclone.streamcloneapplier): | |
299 | requirements = streamclone.readbundle1header(fh)[2] |
|
291 | requirements = streamclone.readbundle1header(fh)[2] | |
300 |
|
|
292 | formatted = bundle2._formatrequirementsparams(requirements) | |
|
293 | return 'none-packed1;%s' % formatted | |||
301 | else: |
|
294 | else: | |
302 | raise error.Abort(_('unknown bundle type: %s') % b) |
|
295 | raise error.Abort(_('unknown bundle type: %s') % b) | |
303 |
|
296 | |||
@@ -1825,29 +1818,8 b' def getbundlechunks(repo, source, heads=' | |||||
1825 | return info, bundler.getchunks() |
|
1818 | return info, bundler.getchunks() | |
1826 |
|
1819 | |||
1827 | @getbundle2partsgenerator('stream2') |
|
1820 | @getbundle2partsgenerator('stream2') | |
1828 |
def _getbundlestream2(bundler, repo, s |
|
1821 | def _getbundlestream2(bundler, repo, *args, **kwargs): | |
1829 | b2caps=None, heads=None, common=None, **kwargs): |
|
1822 | return bundle2.addpartbundlestream2(bundler, repo, **kwargs) | |
1830 | if not kwargs.get('stream', False): |
|
|||
1831 | return |
|
|||
1832 |
|
||||
1833 | if not streamclone.allowservergeneration(repo): |
|
|||
1834 | raise error.Abort(_('stream data requested but server does not allow ' |
|
|||
1835 | 'this feature'), |
|
|||
1836 | hint=_('well-behaved clients should not be ' |
|
|||
1837 | 'requesting stream data from servers not ' |
|
|||
1838 | 'advertising it; the client may be buggy')) |
|
|||
1839 |
|
||||
1840 | # Stream clones don't compress well. And compression undermines a |
|
|||
1841 | # goal of stream clones, which is to be fast. Communicate the desire |
|
|||
1842 | # to avoid compression to consumers of the bundle. |
|
|||
1843 | bundler.prefercompressed = False |
|
|||
1844 |
|
||||
1845 | filecount, bytecount, it = streamclone.generatev2(repo) |
|
|||
1846 | requirements = _formatrequirementsspec(repo.requirements) |
|
|||
1847 | part = bundler.newpart('stream2', data=it) |
|
|||
1848 | part.addparam('bytecount', '%d' % bytecount, mandatory=True) |
|
|||
1849 | part.addparam('filecount', '%d' % filecount, mandatory=True) |
|
|||
1850 | part.addparam('requirements', requirements, mandatory=True) |
|
|||
1851 |
|
1823 | |||
1852 | @getbundle2partsgenerator('changegroup') |
|
1824 | @getbundle2partsgenerator('changegroup') | |
1853 | def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None, |
|
1825 | def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None, |
General Comments 0
You need to be logged in to leave comments.
Login now