tests/test-bundle2.t
author Pierre-Yves David <pierre-yves.david@fb.com>
Wed, 19 Mar 2014 17:11:49 -0700
changeset 20843 0641b41b0b49
parent 20842 938718d72624
child 20844 2631204d7305
permissions -rw-r--r--
bundle2: print debug information during unbundling The unbundler class is now feed with an ui object and use it to transmit data about the unbundling process.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20801
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     1
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     2
Create an extension to test bundle2 API
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     3
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     4
  $ cat > bundle2.py << EOF
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     5
  > """A small extension to test bundle2 implementation
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     6
  > 
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     7
  > Current bundle2 implementation is far too limited to be used in any core
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     8
  > code. We still need to be able to test it while it grow up.
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
     9
  > """
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    10
  > 
20802
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    11
  > import sys
20801
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    12
  > from mercurial import cmdutil
20813
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
    13
  > from mercurial import util
20801
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    14
  > from mercurial import bundle2
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    15
  > cmdtable = {}
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    16
  > command = cmdutil.command(cmdtable)
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    17
  > 
20804
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    18
  > @command('bundle2',
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    19
  >          [('', 'param', [], 'stream level parameter'),],
20841
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
    20
  >          '[OUTPUTFILE]')
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
    21
  > def cmdbundle2(ui, repo, path=None, **opts):
20801
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    22
  >     """write a bundle2 container on standard ouput"""
20842
938718d72624 bundle2: print debug information during bundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20841
diff changeset
    23
  >     bundler = bundle2.bundle20(ui)
20804
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    24
  >     for p in opts['param']:
20809
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
    25
  >         p = p.split('=', 1)
20813
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
    26
  >         try:
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
    27
  >             bundler.addparam(*p)
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
    28
  >         except ValueError, exc:
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
    29
  >             raise util.Abort('%s' % exc)
20809
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
    30
  > 
20841
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
    31
  >     if path is None:
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
    32
  >        file = sys.stdout
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
    33
  >     else:
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
    34
  >         file = open(path, 'w')
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
    35
  > 
20804
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    36
  >     for chunk in bundler.getchunks():
20841
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
    37
  >         file.write(chunk)
20802
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    38
  > 
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    39
  > @command('unbundle2', [], '')
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    40
  > def cmdunbundle2(ui, repo):
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    41
  >     """read a bundle2 container from standard input"""
20843
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
    42
  >     unbundler = bundle2.unbundle20(ui, sys.stdin)
20802
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    43
  >     ui.write('options count: %i\n' % len(unbundler.params))
20805
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
    44
  >     for key in sorted(unbundler.params):
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
    45
  >         ui.write('- %s\n' % key)
20810
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
    46
  >         value = unbundler.params[key]
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
    47
  >         if value is not None:
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
    48
  >             ui.write('    %s\n' % value)
20802
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    49
  >     parts = list(unbundler)
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    50
  >     ui.write('parts count:   %i\n' % len(parts))
20801
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    51
  > EOF
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    52
  $ cat >> $HGRCPATH << EOF
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    53
  > [extensions]
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    54
  > bundle2=$TESTTMP/bundle2.py
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    55
  > EOF
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    56
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    57
The extension requires a repo (currently unused)
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    58
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    59
  $ hg init main
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    60
  $ cd main
20803
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    61
  $ touch a
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    62
  $ hg add a
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    63
  $ hg commit -m 'a'
20801
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    64
20804
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    65
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    66
Empty bundle
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    67
=================
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    68
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    69
- no option
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    70
- no parts
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    71
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    72
Test bundling
20801
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    73
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    74
  $ hg bundle2
9c5183cb9bca bundle2: very first version of a bundle2 bundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
diff changeset
    75
  HG20\x00\x00\x00\x00 (no-eol) (esc)
20802
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    76
20804
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    77
Test unbundling
20802
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    78
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    79
  $ hg bundle2 | hg unbundle2
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    80
  options count: 0
520df53ad26a bundle2: a very first version of bundle2 unbundler
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20801
diff changeset
    81
  parts count:   0
20803
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    82
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    83
Test old style bundle are detected and refused
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    84
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    85
  $ hg bundle --all ../bundle.hg
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    86
  1 changesets found
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    87
  $ hg unbundle2 < ../bundle.hg
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    88
  abort: unknown bundle version 10
88db3e615319 bundle2: make sure the unbundler refuse non bundle2 stream
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20802
diff changeset
    89
  [255]
20804
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    90
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    91
Test parameters
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    92
=================
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    93
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    94
- some options
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    95
- no parts
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    96
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    97
advisory parameters, no value
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    98
-------------------------------
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
    99
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   100
Simplest possible parameters form
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   101
20805
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   102
Test generation simple option
20804
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   103
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   104
  $ hg bundle2 --param 'caution'
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   105
  HG20\x00\x07caution\x00\x00 (no-eol) (esc)
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   106
20805
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   107
Test unbundling
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   108
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   109
  $ hg bundle2 --param 'caution' | hg unbundle2
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   110
  options count: 1
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   111
  - caution
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   112
  parts count:   0
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   113
20804
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   114
Test generation multiple option
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   115
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   116
  $ hg bundle2 --param 'caution' --param 'meal'
db9d3991d2c6 bundle2: support bundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20803
diff changeset
   117
  HG20\x00\x0ccaution meal\x00\x00 (no-eol) (esc)
20805
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   118
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   119
Test unbundling
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   120
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   121
  $ hg bundle2 --param 'caution' --param 'meal' | hg unbundle2
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   122
  options count: 2
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   123
  - caution
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   124
  - meal
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   125
  parts count:   0
c5aaeca0cfbf bundle2: support for unbundling simple parameter
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20804
diff changeset
   126
20809
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
   127
advisory parameters, with value
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
   128
-------------------------------
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
   129
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
   130
Test generation
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
   131
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
   132
  $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants'
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
   133
  HG20\x00\x1ccaution meal=vegan elephants\x00\x00 (no-eol) (esc)
b93bb639451a bundle2: support for bundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20805
diff changeset
   134
20810
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
   135
Test unbundling
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
   136
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
   137
  $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants' | hg unbundle2
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
   138
  options count: 3
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
   139
  - caution
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
   140
  - elephants
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
   141
  - meal
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
   142
      vegan
47293877b54c bundle2: support for unbundling parameter value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20809
diff changeset
   143
  parts count:   0
20811
9785c3f8f598 bundle2: urlquote stream parameter name and value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20810
diff changeset
   144
9785c3f8f598 bundle2: urlquote stream parameter name and value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20810
diff changeset
   145
parameter with special char in value
9785c3f8f598 bundle2: urlquote stream parameter name and value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20810
diff changeset
   146
---------------------------------------------------
9785c3f8f598 bundle2: urlquote stream parameter name and value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20810
diff changeset
   147
9785c3f8f598 bundle2: urlquote stream parameter name and value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20810
diff changeset
   148
Test generation
9785c3f8f598 bundle2: urlquote stream parameter name and value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20810
diff changeset
   149
9785c3f8f598 bundle2: urlquote stream parameter name and value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20810
diff changeset
   150
  $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple
9785c3f8f598 bundle2: urlquote stream parameter name and value
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20810
diff changeset
   151
  HG20\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
20812
e2f908773754 bundle2: urlunquote stream parameter name and value during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20811
diff changeset
   152
e2f908773754 bundle2: urlunquote stream parameter name and value during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20811
diff changeset
   153
Test unbundling
e2f908773754 bundle2: urlunquote stream parameter name and value during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20811
diff changeset
   154
e2f908773754 bundle2: urlunquote stream parameter name and value during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20811
diff changeset
   155
  $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple | hg unbundle2
e2f908773754 bundle2: urlunquote stream parameter name and value during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20811
diff changeset
   156
  options count: 2
e2f908773754 bundle2: urlunquote stream parameter name and value during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20811
diff changeset
   157
  - e|! 7/
e2f908773754 bundle2: urlunquote stream parameter name and value during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20811
diff changeset
   158
      babar%#==tutu
e2f908773754 bundle2: urlunquote stream parameter name and value during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20811
diff changeset
   159
  - simple
e2f908773754 bundle2: urlunquote stream parameter name and value during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20811
diff changeset
   160
  parts count:   0
20813
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
   161
20841
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   162
Test debug output
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   163
---------------------------------------------------
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   164
20843
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   165
bundling debug
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   166
20841
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   167
  $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2
20842
938718d72624 bundle2: print debug information during bundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20841
diff changeset
   168
  start emission of HG20 stream
938718d72624 bundle2: print debug information during bundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20841
diff changeset
   169
  bundle parameter: e%7C%21%207/=babar%25%23%3D%3Dtutu simple
938718d72624 bundle2: print debug information during bundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20841
diff changeset
   170
  end of bundle
20841
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   171
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   172
file content is ok
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   173
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   174
  $ cat ../out.hg2
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   175
  HG20\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
cff562fe77a0 bundle2: add ability to write to a file to the test
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20814
diff changeset
   176
20843
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   177
unbundling debug
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   178
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   179
  $ hg unbundle2 --debug < ../out.hg2
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   180
  start processing of HG20 stream
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   181
  reading bundle2 stream parameters
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   182
  options count: 2
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   183
  - e|! 7/
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   184
      babar%#==tutu
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   185
  - simple
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   186
  start extraction of bundle2 parts
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   187
  end of bundle2 stream
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   188
  parts count:   0
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   189
0641b41b0b49 bundle2: print debug information during unbundling
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20842
diff changeset
   190
20813
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
   191
Test buggy input
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
   192
---------------------------------------------------
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
   193
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
   194
empty parameter name
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
   195
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
   196
  $ hg bundle2 --param '' --quiet
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
   197
  abort: empty parameter name
8c74b3ce5b70 bundle2: refuse empty parameter name
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20812
diff changeset
   198
  [255]
20814
8532f5e1b9df bundle2: force the first char of parameter to be an letter.
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20813
diff changeset
   199
8532f5e1b9df bundle2: force the first char of parameter to be an letter.
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20813
diff changeset
   200
bad parameter name
8532f5e1b9df bundle2: force the first char of parameter to be an letter.
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20813
diff changeset
   201
8532f5e1b9df bundle2: force the first char of parameter to be an letter.
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20813
diff changeset
   202
  $ hg bundle2 --param 42babar
8532f5e1b9df bundle2: force the first char of parameter to be an letter.
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20813
diff changeset
   203
  abort: non letter first character: '42babar'
8532f5e1b9df bundle2: force the first char of parameter to be an letter.
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 20813
diff changeset
   204
  [255]