tests/test-wireproto-command-heads.t
changeset 37485 0b7475ea38cf
child 37645 72b0982cd509
equal deleted inserted replaced
37484:c22fd3c4c23e 37485:0b7475ea38cf
       
     1   $ . $TESTDIR/wireprotohelpers.sh
       
     2 
       
     3   $ hg init server
       
     4   $ enablehttpv2 server
       
     5   $ cd server
       
     6   $ hg debugdrawdag << EOF
       
     7   > H I J
       
     8   > | | |
       
     9   > E F G
       
    10   > | |/
       
    11   > C D
       
    12   > |/
       
    13   > B
       
    14   > |
       
    15   > A
       
    16   > EOF
       
    17 
       
    18   $ hg phase --force --secret J
       
    19   $ hg phase --public E
       
    20 
       
    21   $ hg log -r 'E + H + I + G + J' -T '{rev}:{node} {desc} {phase}\n'
       
    22   4:78d2dca436b2f5b188ac267e29b81e07266d38fc E public
       
    23   7:ae492e36b0c8339ffaf328d00b85b4525de1165e H draft
       
    24   8:1d6f6b91d44aaba6d5e580bc30a9948530dbe00b I draft
       
    25   6:29446d2dc5419c5f97447a8bc062e4cc328bf241 G draft
       
    26   9:dec04b246d7cbb670c6689806c05ad17c835284e J secret
       
    27 
       
    28   $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log
       
    29   $ cat hg.pid > $DAEMON_PIDS
       
    30 
       
    31 All non-secret heads returned by default
       
    32 
       
    33   $ sendhttpv2peer << EOF
       
    34   > command heads
       
    35   > EOF
       
    36   creating http peer for wire protocol version 2
       
    37   sending heads command
       
    38   s>     POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
       
    39   s>     Accept-Encoding: identity\r\n
       
    40   s>     accept: application/mercurial-exp-framing-0003\r\n
       
    41   s>     content-type: application/mercurial-exp-framing-0003\r\n
       
    42   s>     content-length: 20\r\n
       
    43   s>     host: $LOCALIP:$HGPORT\r\n (glob)
       
    44   s>     user-agent: Mercurial debugwireproto\r\n
       
    45   s>     \r\n
       
    46   s>     \x0c\x00\x00\x01\x00\x01\x01\x11\xa1DnameEheads
       
    47   s> makefile('rb', None)
       
    48   s>     HTTP/1.1 200 OK\r\n
       
    49   s>     Server: testing stub value\r\n
       
    50   s>     Date: $HTTP_DATE$\r\n
       
    51   s>     Content-Type: application/mercurial-exp-framing-0003\r\n
       
    52   s>     Transfer-Encoding: chunked\r\n
       
    53   s>     \r\n
       
    54   s>     48\r\n
       
    55   s>     @\x00\x00\x01\x00\x02\x01F
       
    56   s>     \x83T\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0bT\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^T)Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A
       
    57   s>     \r\n
       
    58   received frame(size=64; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
       
    59   s>     0\r\n
       
    60   s>     \r\n
       
    61   response: [[b'\x1dok\x91\xd4J\xab\xa6\xd5\xe5\x80\xbc0\xa9\x94\x850\xdb\xe0\x0b', b'\xaeI.6\xb0\xc83\x9f\xfa\xf3(\xd0\x0b\x85\xb4R]\xe1\x16^', b')Dm-\xc5A\x9c_\x97Dz\x8b\xc0b\xe4\xcc2\x8b\xf2A']]
       
    62 
       
    63 Requesting just the public heads works
       
    64 
       
    65   $ sendhttpv2peer << EOF
       
    66   > command heads
       
    67   >     publiconly 1
       
    68   > EOF
       
    69   creating http peer for wire protocol version 2
       
    70   sending heads command
       
    71   s>     POST /api/exp-http-v2-0001/ro/heads HTTP/1.1\r\n
       
    72   s>     Accept-Encoding: identity\r\n
       
    73   s>     accept: application/mercurial-exp-framing-0003\r\n
       
    74   s>     content-type: application/mercurial-exp-framing-0003\r\n
       
    75   s>     content-length: 39\r\n
       
    76   s>     host: $LOCALIP:$HGPORT\r\n (glob)
       
    77   s>     user-agent: Mercurial debugwireproto\r\n
       
    78   s>     \r\n
       
    79   s>     \x1f\x00\x00\x01\x00\x01\x01\x11\xa2Dargs\xa1JpubliconlyA1DnameEheads
       
    80   s> makefile('rb', None)
       
    81   s>     HTTP/1.1 200 OK\r\n
       
    82   s>     Server: testing stub value\r\n
       
    83   s>     Date: $HTTP_DATE$\r\n
       
    84   s>     Content-Type: application/mercurial-exp-framing-0003\r\n
       
    85   s>     Transfer-Encoding: chunked\r\n
       
    86   s>     \r\n
       
    87   s>     1e\r\n
       
    88   s>     \x16\x00\x00\x01\x00\x02\x01F
       
    89   s>     \x81Tx\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc
       
    90   s>     \r\n
       
    91   received frame(size=22; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
       
    92   s>     0\r\n
       
    93   s>     \r\n
       
    94   response: [[b'x\xd2\xdc\xa46\xb2\xf5\xb1\x88\xac&~)\xb8\x1e\x07&m8\xfc']]
       
    95 
       
    96   $ cat error.log