Show More
@@ -1199,12 +1199,12 def bundle(ui, repo, fname, dest=None, * | |||
|
1199 | 1199 | |
|
1200 | 1200 | bundletype = opts.get('type', 'bzip2').lower() |
|
1201 | 1201 | try: |
|
1202 | bcompression, cgversion, params = exchange.parsebundlespec( | |
|
1203 | repo, bundletype, strict=False) | |
|
1202 | bundlespec = exchange.parsebundlespec(repo, bundletype, strict=False) | |
|
1204 | 1203 | except error.UnsupportedBundleSpecification as e: |
|
1205 | 1204 | raise error.Abort(pycompat.bytestr(e), |
|
1206 | 1205 | hint=_("see 'hg help bundlespec' for supported " |
|
1207 | 1206 | "values for --type")) |
|
1207 | cgversion = bundlespec.version | |
|
1208 | 1208 | |
|
1209 | 1209 | # Packed bundles are a pseudo bundle format for now. |
|
1210 | 1210 | if cgversion == 's1': |
@@ -1246,6 +1246,7 def bundle(ui, repo, fname, dest=None, * | |||
|
1246 | 1246 | scmutil.nochangesfound(ui, repo, not base and outgoing.excluded) |
|
1247 | 1247 | return 1 |
|
1248 | 1248 | |
|
1249 | bcompression = bundlespec.compression | |
|
1249 | 1250 | if cgversion == '01': #bundle1 |
|
1250 | 1251 | if bcompression is None: |
|
1251 | 1252 | bcompression = 'UN' |
@@ -17,6 +17,9 from .node import ( | |||
|
17 | 17 | hex, |
|
18 | 18 | nullid, |
|
19 | 19 | ) |
|
20 | from .thirdparty import ( | |
|
21 | attr, | |
|
22 | ) | |
|
20 | 23 | from . import ( |
|
21 | 24 | bookmarks as bookmod, |
|
22 | 25 | bundle2, |
@@ -52,6 +55,12 urlreq = util.urlreq | |||
|
52 | 55 | # Compression engines allowed in version 1. THIS SHOULD NEVER CHANGE. |
|
53 | 56 | _bundlespecv1compengines = {'gzip', 'bzip2', 'none'} |
|
54 | 57 | |
|
58 | @attr.s | |
|
59 | class bundlespec(object): | |
|
60 | compression = attr.ib() | |
|
61 | version = attr.ib() | |
|
62 | params = attr.ib() | |
|
63 | ||
|
55 | 64 | def parsebundlespec(repo, spec, strict=True, externalnames=False): |
|
56 | 65 | """Parse a bundle string specification into parts. |
|
57 | 66 | |
@@ -75,8 +84,9 def parsebundlespec(repo, spec, strict=T | |||
|
75 | 84 | If ``externalnames`` is False (the default), the human-centric names will |
|
76 | 85 | be converted to their internal representation. |
|
77 | 86 | |
|
78 |
Returns a |
|
|
79 |
be ``None`` if not in strict mode and a compression isn't |
|
|
87 | Returns a bundlespec object of (compression, version, parameters). | |
|
88 | Compression will be ``None`` if not in strict mode and a compression isn't | |
|
89 | defined. | |
|
80 | 90 | |
|
81 | 91 | An ``InvalidBundleSpecification`` is raised when the specification is |
|
82 | 92 | not syntactically well formed. |
@@ -172,7 +182,8 def parsebundlespec(repo, spec, strict=T | |||
|
172 | 182 | engine = util.compengines.forbundlename(compression) |
|
173 | 183 | compression = engine.bundletype()[1] |
|
174 | 184 | version = _bundlespeccgversions[version] |
|
175 | return compression, version, params | |
|
185 | ||
|
186 | return bundlespec(compression, version, params) | |
|
176 | 187 | |
|
177 | 188 | def readbundle(ui, fh, fname, vfs=None): |
|
178 | 189 | header = changegroup.readexactly(fh, 4) |
@@ -2140,10 +2151,10 def parseclonebundlesmanifest(repo, s): | |||
|
2140 | 2151 | # component of the BUNDLESPEC. |
|
2141 | 2152 | if key == 'BUNDLESPEC': |
|
2142 | 2153 | try: |
|
2143 |
|
|
|
2154 | bundlespec = parsebundlespec(repo, value, | |
|
2144 | 2155 |
|
|
2145 | attrs['COMPRESSION'] = comp | |
|
2146 | attrs['VERSION'] = version | |
|
2156 | attrs['COMPRESSION'] = bundlespec.compression | |
|
2157 | attrs['VERSION'] = bundlespec.version | |
|
2147 | 2158 | except error.InvalidBundleSpecification: |
|
2148 | 2159 | pass |
|
2149 | 2160 | except error.UnsupportedBundleSpecification: |
@@ -2168,10 +2179,12 def filterclonebundleentries(repo, entri | |||
|
2168 | 2179 | spec = entry.get('BUNDLESPEC') |
|
2169 | 2180 | if spec: |
|
2170 | 2181 | try: |
|
2171 |
|
|
|
2182 | bundlespec = parsebundlespec(repo, spec, strict=True) | |
|
2172 | 2183 | |
|
2173 | 2184 | # If a stream clone was requested, filter out non-streamclone |
|
2174 | 2185 | # entries. |
|
2186 | comp = bundlespec.compression | |
|
2187 | version = bundlespec.version | |
|
2175 | 2188 | if streamclonerequested and (comp != 'UN' or version != 's1'): |
|
2176 | 2189 | repo.ui.debug('filtering %s because not a stream clone\n' % |
|
2177 | 2190 | entry['URL']) |
General Comments 0
You need to be logged in to leave comments.
Login now