Show More
@@ -283,26 +283,18 b' class bundlerepository(localrepo.localre' | |||||
283 | self.bundlefile = self.bundle = exchange.readbundle(ui, f, bundlename) |
|
283 | self.bundlefile = self.bundle = exchange.readbundle(ui, f, bundlename) | |
284 |
|
284 | |||
285 | if isinstance(self.bundle, bundle2.unbundle20): |
|
285 | if isinstance(self.bundle, bundle2.unbundle20): | |
286 |
|
|
286 | hadchangegroup = False | |
287 | for part in self.bundle.iterparts(): |
|
287 | for part in self.bundle.iterparts(): | |
288 | if part.type == 'changegroup': |
|
288 | if part.type == 'changegroup': | |
289 |
if |
|
289 | if hadchangegroup: | |
290 | raise NotImplementedError("can't process " |
|
290 | raise NotImplementedError("can't process " | |
291 | "multiple changegroups") |
|
291 | "multiple changegroups") | |
292 |
|
|
292 | hadchangegroup = True | |
293 | version = part.params.get('version', '01') |
|
|||
294 | legalcgvers = changegroup.supportedincomingversions(self) |
|
|||
295 | if version not in legalcgvers: |
|
|||
296 | msg = _('Unsupported changegroup version: %s') |
|
|||
297 | raise error.Abort(msg % version) |
|
|||
298 | if self.bundle.compressed(): |
|
|||
299 | cgstream = self._writetempbundle(part.read, |
|
|||
300 | ".cg%sun" % version) |
|
|||
301 |
|
293 | |||
302 | if cgstream is None: |
|
294 | self._handlebundle2part(part) | |
303 | raise error.Abort(_('No changegroups found')) |
|
|||
304 |
|
295 | |||
305 | self.bundle = changegroup.getunbundler(version, cgstream, 'UN') |
|
296 | if not hadchangegroup: | |
|
297 | raise error.Abort(_("No changegroups found")) | |||
306 |
|
298 | |||
307 | elif self.bundle.compressed(): |
|
299 | elif self.bundle.compressed(): | |
308 | f = self._writetempbundle(self.bundle.read, '.hg10un', |
|
300 | f = self._writetempbundle(self.bundle.read, '.hg10un', | |
@@ -318,6 +310,20 b' class bundlerepository(localrepo.localre' | |||||
318 | phases.retractboundary(self, None, phases.draft, |
|
310 | phases.retractboundary(self, None, phases.draft, | |
319 | [ctx.node() for ctx in self[self.firstnewrev:]]) |
|
311 | [ctx.node() for ctx in self[self.firstnewrev:]]) | |
320 |
|
312 | |||
|
313 | def _handlebundle2part(self, part): | |||
|
314 | if part.type == 'changegroup': | |||
|
315 | cgstream = part | |||
|
316 | version = part.params.get('version', '01') | |||
|
317 | legalcgvers = changegroup.supportedincomingversions(self) | |||
|
318 | if version not in legalcgvers: | |||
|
319 | msg = _('Unsupported changegroup version: %s') | |||
|
320 | raise error.Abort(msg % version) | |||
|
321 | if self.bundle.compressed(): | |||
|
322 | cgstream = self._writetempbundle(part.read, | |||
|
323 | ".cg%sun" % version) | |||
|
324 | ||||
|
325 | self.bundle = changegroup.getunbundler(version, cgstream, 'UN') | |||
|
326 | ||||
321 | def _writetempbundle(self, readfn, suffix, header=''): |
|
327 | def _writetempbundle(self, readfn, suffix, header=''): | |
322 | """Write a temporary file to disk |
|
328 | """Write a temporary file to disk | |
323 | """ |
|
329 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now