Show More
@@ -329,16 +329,7 b' def consumev1(repo, fp, filecount, bytec' | |||||
329 | (util.bytecount(bytecount), elapsed, |
|
329 | (util.bytecount(bytecount), elapsed, | |
330 | util.bytecount(bytecount / elapsed))) |
|
330 | util.bytecount(bytecount / elapsed))) | |
331 |
|
331 | |||
332 |
def |
|
332 | def readbundle1header(fp): | |
333 | """Apply the content from a stream clone bundle version 1. |
|
|||
334 |
|
||||
335 | We assume the 4 byte header has been read and validated and the file handle |
|
|||
336 | is at the 2 byte compression identifier. |
|
|||
337 | """ |
|
|||
338 | if len(repo): |
|
|||
339 | raise error.Abort(_('cannot apply stream clone bundle on non-empty ' |
|
|||
340 | 'repo')) |
|
|||
341 |
|
||||
342 | compression = fp.read(2) |
|
333 | compression = fp.read(2) | |
343 | if compression != 'UN': |
|
334 | if compression != 'UN': | |
344 | raise error.Abort(_('only uncompressed stream clone bundles are ' |
|
335 | raise error.Abort(_('only uncompressed stream clone bundles are ' | |
@@ -353,6 +344,20 b' def applybundlev1(repo, fp):' | |||||
353 | 'requirements not properly encoded')) |
|
344 | 'requirements not properly encoded')) | |
354 |
|
345 | |||
355 | requirements = set(requires.rstrip('\0').split(',')) |
|
346 | requirements = set(requires.rstrip('\0').split(',')) | |
|
347 | ||||
|
348 | return filecount, bytecount, requirements | |||
|
349 | ||||
|
350 | def applybundlev1(repo, fp): | |||
|
351 | """Apply the content from a stream clone bundle version 1. | |||
|
352 | ||||
|
353 | We assume the 4 byte header has been read and validated and the file handle | |||
|
354 | is at the 2 byte compression identifier. | |||
|
355 | """ | |||
|
356 | if len(repo): | |||
|
357 | raise error.Abort(_('cannot apply stream clone bundle on non-empty ' | |||
|
358 | 'repo')) | |||
|
359 | ||||
|
360 | filecount, bytecount, requirements = readbundle1header(fp) | |||
356 | missingreqs = requirements - repo.supportedformats |
|
361 | missingreqs = requirements - repo.supportedformats | |
357 | if missingreqs: |
|
362 | if missingreqs: | |
358 | raise error.Abort(_('unable to apply stream clone: ' |
|
363 | raise error.Abort(_('unable to apply stream clone: ' |
General Comments 0
You need to be logged in to leave comments.
Login now