##// END OF EJS Templates
bundle2: use an official iterparts method to unbundle parts...
Pierre-Yves David -
r21129:07bcbf32 default
parent child Browse files
Show More
@@ -286,7 +286,7 b' def processbundle(repo, unbundler, trans'
286 # - replace this is a init function soon.
286 # - replace this is a init function soon.
287 # - exception catching
287 # - exception catching
288 unbundler.params
288 unbundler.params
289 iterparts = iter(unbundler)
289 iterparts = unbundler.iterparts()
290 part = None
290 part = None
291 try:
291 try:
292 for part in iterparts:
292 for part in iterparts:
@@ -397,7 +397,8 b' class unpackermixin(object):'
397 class unbundle20(unpackermixin):
397 class unbundle20(unpackermixin):
398 """interpret a bundle2 stream
398 """interpret a bundle2 stream
399
399
400 (this will eventually yield parts)"""
400 This class is fed with a binary stream and yields parts through its
401 `iterparts` methods."""
401
402
402 def __init__(self, ui, fp, header=None):
403 def __init__(self, ui, fp, header=None):
403 """If header is specified, we do not read it out of the stream."""
404 """If header is specified, we do not read it out of the stream."""
@@ -450,7 +451,7 b' class unbundle20(unpackermixin):'
450 raise KeyError(name)
451 raise KeyError(name)
451
452
452
453
453 def __iter__(self):
454 def iterparts(self):
454 """yield all parts contained in the stream"""
455 """yield all parts contained in the stream"""
455 # make sure param have been loaded
456 # make sure param have been loaded
456 self.params
457 self.params
@@ -143,7 +143,7 b' Create an extension to test bundle2 API'
143 > if value is not None:
143 > if value is not None:
144 > ui.write(' %s\n' % value)
144 > ui.write(' %s\n' % value)
145 > count = 0
145 > count = 0
146 > for p in unbundler:
146 > for p in unbundler.iterparts():
147 > count += 1
147 > count += 1
148 > ui.write(' :%s:\n' % p.type)
148 > ui.write(' :%s:\n' % p.type)
149 > ui.write(' mandatory: %i\n' % len(p.mandatoryparams))
149 > ui.write(' mandatory: %i\n' % len(p.mandatoryparams))
General Comments 0
You need to be logged in to leave comments. Login now