tests/test-bundle2.t
changeset 20877 9e9e3a4e9261
parent 20876 ddd56f3eb786
child 20888 0b0d3800c248
equal deleted inserted replaced
20876:ddd56f3eb786 20877:9e9e3a4e9261
    39   >        bundler.addpart(part)
    39   >        bundler.addpart(part)
    40   >        # add a second one to make sure we handle multiple parts
    40   >        # add a second one to make sure we handle multiple parts
    41   >        part = bundle2.part('test:empty')
    41   >        part = bundle2.part('test:empty')
    42   >        bundler.addpart(part)
    42   >        bundler.addpart(part)
    43   >        part = bundle2.part('test:song', data=ELEPHANTSSONG)
    43   >        part = bundle2.part('test:song', data=ELEPHANTSSONG)
       
    44   >        bundler.addpart(part)
       
    45   >        part = bundle2.part('test:math',
       
    46   >                            [('pi', '3.14'), ('e', '2.72')],
       
    47   >                            [('cooking', 'raw')],
       
    48   >                            '42')
    44   >        bundler.addpart(part)
    49   >        bundler.addpart(part)
    45   > 
    50   > 
    46   >     if path is None:
    51   >     if path is None:
    47   >        file = sys.stdout
    52   >        file = sys.stdout
    48   >     else:
    53   >     else:
    67   >             ui.write('    %s\n' % value)
    72   >             ui.write('    %s\n' % value)
    68   >     parts = list(unbundler)
    73   >     parts = list(unbundler)
    69   >     ui.write('parts count:   %i\n' % len(parts))
    74   >     ui.write('parts count:   %i\n' % len(parts))
    70   >     for p in parts:
    75   >     for p in parts:
    71   >         ui.write('  :%s:\n' % p.type)
    76   >         ui.write('  :%s:\n' % p.type)
       
    77   >         ui.write('    mandatory: %i\n' % len(p.mandatoryparams))
       
    78   >         ui.write('    advisory: %i\n' % len(p.advisoryparams))
    72   >         ui.write('    payload: %i bytes\n' % len(p.data))
    79   >         ui.write('    payload: %i bytes\n' % len(p.data))
    73   > EOF
    80   > EOF
    74   $ cat >> $HGRCPATH << EOF
    81   $ cat >> $HGRCPATH << EOF
    75   > [extensions]
    82   > [extensions]
    76   > bundle2=$TESTTMP/bundle2.py
    83   > bundle2=$TESTTMP/bundle2.py
   245   bundle parameter: 
   252   bundle parameter: 
   246   start of parts
   253   start of parts
   247   bundle part: "test:empty"
   254   bundle part: "test:empty"
   248   bundle part: "test:empty"
   255   bundle part: "test:empty"
   249   bundle part: "test:song"
   256   bundle part: "test:song"
       
   257   bundle part: "test:math"
   250   end of bundle
   258   end of bundle
   251 
   259 
   252   $ cat ../parts.hg2
   260   $ cat ../parts.hg2
   253   HG20\x00\x00\x00\r (esc)
   261   HG20\x00\x00\x00\r (esc)
   254   test:empty\x00\x00\x00\x00\x00\x00\x00\r (esc)
   262   test:empty\x00\x00\x00\x00\x00\x00\x00\r (esc)
   255   test:empty\x00\x00\x00\x00\x00\x00\x00\x0c	test:song\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc)
   263   test:empty\x00\x00\x00\x00\x00\x00\x00\x0c	test:song\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc)
   256   Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
   264   Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
   257   Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
   265   Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00'	test:math\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x00 (no-eol) (esc)
   258 
   266 
   259 
   267 
   260   $ hg unbundle2 < ../parts.hg2
   268   $ hg unbundle2 < ../parts.hg2
   261   options count: 0
   269   options count: 0
   262   parts count:   3
   270   parts count:   4
   263     :test:empty:
   271     :test:empty:
       
   272       mandatory: 0
       
   273       advisory: 0
   264       payload: 0 bytes
   274       payload: 0 bytes
   265     :test:empty:
   275     :test:empty:
       
   276       mandatory: 0
       
   277       advisory: 0
   266       payload: 0 bytes
   278       payload: 0 bytes
   267     :test:song:
   279     :test:song:
       
   280       mandatory: 0
       
   281       advisory: 0
   268       payload: 178 bytes
   282       payload: 178 bytes
       
   283     :test:math:
       
   284       mandatory: 2
       
   285       advisory: 1
       
   286       payload: 2 bytes
   269 
   287 
   270   $ hg unbundle2 --debug < ../parts.hg2
   288   $ hg unbundle2 --debug < ../parts.hg2
   271   start processing of HG20 stream
   289   start processing of HG20 stream
   272   reading bundle2 stream parameters
   290   reading bundle2 stream parameters
   273   options count: 0
   291   options count: 0
   283   part header size: 12
   301   part header size: 12
   284   part type: "test:song"
   302   part type: "test:song"
   285   part parameters: 0
   303   part parameters: 0
   286   payload chunk size: 178
   304   payload chunk size: 178
   287   payload chunk size: 0
   305   payload chunk size: 0
       
   306   part header size: 39
       
   307   part type: "test:math"
       
   308   part parameters: 3
       
   309   payload chunk size: 2
       
   310   payload chunk size: 0
   288   part header size: 0
   311   part header size: 0
   289   end of bundle2 stream
   312   end of bundle2 stream
   290   parts count:   3
   313   parts count:   4
   291     :test:empty:
   314     :test:empty:
       
   315       mandatory: 0
       
   316       advisory: 0
   292       payload: 0 bytes
   317       payload: 0 bytes
   293     :test:empty:
   318     :test:empty:
       
   319       mandatory: 0
       
   320       advisory: 0
   294       payload: 0 bytes
   321       payload: 0 bytes
   295     :test:song:
   322     :test:song:
       
   323       mandatory: 0
       
   324       advisory: 0
   296       payload: 178 bytes
   325       payload: 178 bytes
       
   326     :test:math:
       
   327       mandatory: 2
       
   328       advisory: 1
       
   329       payload: 2 bytes