def unpack_chunks(hg_unbundle10_obj):
 while True:
  (length,) = struct.unpack('>l', readexactly(hg_unbundle10_obj, 4))
  if (length <= 4):
   break
  if (length < 84):
   raise Exception('negative data length')
  (node, p1, p2, cs) = struct.unpack('20s20s20s20s', readexactly(hg_unbundle10_obj, 80))
  (yield {'node': node.encode('hex'), 'p1': p1.encode('hex'), 'p2': p2.encode('hex'), 'cs': cs.encode('hex'), 'data': [patch for patch in unpack_patches(hg_unbundle10_obj, (length - 84))]})

def unpack_chunks ( hg_unbundle10_obj ) : while True : ( length , ) = struct . unpack ( '>l' , readexactly ( hg_unbundle10_obj , 4 ) ) if ( length <= 4 ) : break if ( length < 84 ) : raise Exception ( 'negative data length' ) ( node , p1 , p2 , cs ) = struct . unpack ( '20s20s20s20s' , readexactly ( hg_unbundle10_obj , 80 ) ) ( yield { 'node' : node . encode ( 'hex' ) , 'p1' : p1 . encode ( 'hex' ) , 'p2' : p2 . encode ( 'hex' ) , 'cs' : cs . encode ( 'hex' ) , 'data' : [ patch for patch in unpack_patches ( hg_unbundle10_obj , ( length - 84 ) ) ] } )
this method provides a generator of parsed chunks of a "group" in a mercurial unbundle10 object which is created when a changeset that is pushed to a tool shed repository using hg push from the command line is read using readbundle .