tests/test-wireproto-command-filedata.t
author Valentin Gatien-Baron <valentin.gatienbaron@gmail.com>
Sun, 17 May 2020 12:49:12 -0400
changeset 44848 7e7080ab8ba8
parent 40922 ca6372b7e566
child 45906 95c4cca641f6
permissions -rw-r--r--
grep: improve test coverage Differential Revision: https://phab.mercurial-scm.org/D8542
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
  $ . $TESTDIR/wireprotohelpers.sh
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
  $ hg init server
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
  $ enablehttpv2 server
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
  $ cd server
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
     6
  $ cat > a << EOF
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
     7
  > a0
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
     8
  > 00000000000000000000000000000000000000
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
     9
  > 11111111111111111111111111111111111111
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
    10
  > EOF
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
  $ echo b0 > b
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
  $ mkdir -p dir0/child0 dir0/child1 dir1
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
  $ echo c0 > dir0/c
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
  $ echo d0 > dir0/d
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
  $ echo e0 > dir0/child0/e
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
  $ echo f0 > dir0/child1/f
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
  $ hg -q commit -A -m 'commit 0'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
    19
  $ echo a1 >> a
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
  $ echo d1 > dir0/d
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
  $ hg commit -m 'commit 1'
40921
afdbc9c6a333 tests: fix empty commit in test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40048
diff changeset
    22
  $ echo f1 > dir0/child1/f
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
  $ hg commit -m 'commit 2'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    25
  $ hg -q up -r 0
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
    26
  $ echo a2 >> a
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    27
  $ hg commit -m 'commit 3'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
  created new head
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
40922
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    30
Create multiple heads introducing the same changeset
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    31
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    32
  $ hg -q up -r 0
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    33
  $ echo foo > dupe-file
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    34
  $ hg commit -Am 'dupe 1'
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    35
  adding dupe-file
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    36
  created new head
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    37
  $ hg -q up -r 0
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    38
  $ echo foo > dupe-file
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    39
  $ hg commit -Am 'dupe 2'
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    40
  adding dupe-file
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    41
  created new head
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    42
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
  $ hg log -G -T '{rev}:{node} {desc}\n'
40922
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    44
  @  5:732c3dd7bee94242de656000e5f458e7ccfe2828 dupe 2
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
  |
40922
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    46
  | o  4:4334f10897d13c3e8beb4b636f7272b4ec2d0322 dupe 1
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    47
  |/
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    48
  | o  3:5ce944d7fece1252dae06c34422b573c191b9489 commit 3
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    49
  |/
40921
afdbc9c6a333 tests: fix empty commit in test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40048
diff changeset
    50
  | o  2:b3c27db01410dae01e5485d425b1440078df540c commit 2
afdbc9c6a333 tests: fix empty commit in test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40048
diff changeset
    51
  | |
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
    52
  | o  1:3ef5e551f219ba505481d34d6b0316b017fa3f00 commit 1
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    53
  |/
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
    54
  o  0:91b232a2253ce0638496f67bdfd7a4933fb51b25 commit 0
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    55
  
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    56
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    57
  $ hg --debug debugindex a
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    58
     rev linkrev nodeid                                   p1                                       p2
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
    59
       0       0 649d149df43d83882523b7fb1e6a3af6f1907b39 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
    60
       1       1 0a86321f1379d1a9ecd0579a22977af7a5acaf11 649d149df43d83882523b7fb1e6a3af6f1907b39 0000000000000000000000000000000000000000
40921
afdbc9c6a333 tests: fix empty commit in test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40048
diff changeset
    61
       2       3 7e5801b6d5f03a5a54f3c47b583f7567aad43e5b 649d149df43d83882523b7fb1e6a3af6f1907b39 0000000000000000000000000000000000000000
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    62
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    63
  $ hg --debug debugindex dir0/child0/e
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    64
     rev linkrev nodeid                                   p1                                       p2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    65
       0       0 bbba6c06b30f443d34ff841bc985c4d0827c6be4 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    66
40922
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    67
  $ hg --debug debugindex dupe-file
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    68
     rev linkrev nodeid                                   p1                                       p2
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    69
       0       4 2ed2a3912a0b24502043eae84ee4b279c18b90dd 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
    70
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    71
  $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    72
  $ cat hg.pid > $DAEMON_PIDS
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    73
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    74
Missing arguments is an error
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    75
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    76
  $ sendhttpv2peer << EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    77
  > command filedata
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    78
  > EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    79
  creating http peer for wire protocol version 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    80
  sending filedata command
39810
0b61d21f05cc wireprotov2: declare command arguments richly
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39641
diff changeset
    81
  abort: missing required arguments: nodes, path!
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    82
  [255]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    83
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    84
  $ sendhttpv2peer << EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    85
  > command filedata
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    86
  >     nodes eval:[]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    87
  > EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    88
  creating http peer for wire protocol version 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    89
  sending filedata command
39810
0b61d21f05cc wireprotov2: declare command arguments richly
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39641
diff changeset
    90
  abort: missing required arguments: path!
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    91
  [255]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    92
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    93
Unknown node is an error
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    94
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    95
  $ sendhttpv2peer << EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    96
  > command filedata
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    97
  >     nodes eval:[b'\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa']
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    98
  >     path eval:b'a'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    99
  > EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   100
  creating http peer for wire protocol version 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   101
  sending filedata command
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   102
  abort: unknown file node: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   103
  [255]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   104
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   105
Fetching a single revision returns just metadata by default
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   106
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   107
  $ sendhttpv2peer << EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   108
  > command filedata
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   109
  >     nodes eval:[b'\x0a\x86\x32\x1f\x13\x79\xd1\xa9\xec\xd0\x57\x9a\x22\x97\x7a\xf7\xa5\xac\xaf\x11']
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   110
  >     path eval:b'a'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   111
  > EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   112
  creating http peer for wire protocol version 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   113
  sending filedata command
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   114
  response: gen[
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   115
    {
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   116
      b'totalitems': 1
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   117
    },
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   118
    {
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   119
      b'node': b'\n\x862\x1f\x13y\xd1\xa9\xec\xd0W\x9a"\x97z\xf7\xa5\xac\xaf\x11'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   120
    }
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   121
  ]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   122
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   123
Requesting parents works
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   124
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   125
  $ sendhttpv2peer << EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   126
  > command filedata
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   127
  >     nodes eval:[b'\x0a\x86\x32\x1f\x13\x79\xd1\xa9\xec\xd0\x57\x9a\x22\x97\x7a\xf7\xa5\xac\xaf\x11']
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   128
  >     path eval:b'a'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   129
  >     fields eval:[b'parents']
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   130
  > EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   131
  creating http peer for wire protocol version 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   132
  sending filedata command
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   133
  response: gen[
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   134
    {
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   135
      b'totalitems': 1
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   136
    },
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   137
    {
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   138
      b'node': b'\n\x862\x1f\x13y\xd1\xa9\xec\xd0W\x9a"\x97z\xf7\xa5\xac\xaf\x11',
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   139
      b'parents': [
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   140
        b'd\x9d\x14\x9d\xf4=\x83\x88%#\xb7\xfb\x1ej:\xf6\xf1\x90{9',
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   141
        b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   142
      ]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   143
    }
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   144
  ]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   145
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   146
Requesting revision data works
39641
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   147
(haveparents defaults to False, so fulltext is emitted)
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   148
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   149
  $ sendhttpv2peer << EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   150
  > command filedata
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   151
  >     nodes eval:[b'\x0a\x86\x32\x1f\x13\x79\xd1\xa9\xec\xd0\x57\x9a\x22\x97\x7a\xf7\xa5\xac\xaf\x11']
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   152
  >     path eval:b'a'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   153
  >     fields eval:[b'revision']
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   154
  > EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   155
  creating http peer for wire protocol version 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   156
  sending filedata command
39641
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   157
  response: gen[
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   158
    {
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   159
      b'totalitems': 1
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   160
    },
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   161
    {
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   162
      b'fieldsfollowing': [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   163
        [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   164
          b'revision',
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   165
          84
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   166
        ]
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   167
      ],
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   168
      b'node': b'\n\x862\x1f\x13y\xd1\xa9\xec\xd0W\x9a"\x97z\xf7\xa5\xac\xaf\x11'
39641
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   169
    },
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   170
    b'a0\n00000000000000000000000000000000000000\n11111111111111111111111111111111111111\na1\n'
39641
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   171
  ]
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   172
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   173
haveparents=False should be same as above
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   174
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   175
  $ sendhttpv2peer << EOF
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   176
  > command filedata
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   177
  >     nodes eval:[b'\x0a\x86\x32\x1f\x13\x79\xd1\xa9\xec\xd0\x57\x9a\x22\x97\x7a\xf7\xa5\xac\xaf\x11']
39641
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   178
  >     path eval:b'a'
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   179
  >     fields eval:[b'revision']
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   180
  >     haveparents eval:False
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   181
  > EOF
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   182
  creating http peer for wire protocol version 2
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   183
  sending filedata command
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   184
  response: gen[
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   185
    {
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   186
      b'totalitems': 1
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   187
    },
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   188
    {
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   189
      b'fieldsfollowing': [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   190
        [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   191
          b'revision',
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   192
          84
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   193
        ]
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   194
      ],
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   195
      b'node': b'\n\x862\x1f\x13y\xd1\xa9\xec\xd0W\x9a"\x97z\xf7\xa5\xac\xaf\x11'
39641
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   196
    },
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   197
    b'a0\n00000000000000000000000000000000000000\n11111111111111111111111111111111111111\na1\n'
39641
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   198
  ]
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   199
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   200
haveparents=True should emit a delta
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   201
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   202
  $ sendhttpv2peer << EOF
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   203
  > command filedata
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   204
  >     nodes eval:[b'\x0a\x86\x32\x1f\x13\x79\xd1\xa9\xec\xd0\x57\x9a\x22\x97\x7a\xf7\xa5\xac\xaf\x11']
39641
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   205
  >     path eval:b'a'
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   206
  >     fields eval:[b'revision']
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   207
  >     haveparents eval:True
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   208
  > EOF
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   209
  creating http peer for wire protocol version 2
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   210
  sending filedata command
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   211
  response: gen[
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   212
    {
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   213
      b'totalitems': 1
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   214
    },
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   215
    {
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   216
      b'deltabasenode': b'd\x9d\x14\x9d\xf4=\x83\x88%#\xb7\xfb\x1ej:\xf6\xf1\x90{9',
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   217
      b'fieldsfollowing': [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   218
        [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   219
          b'delta',
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   220
          15
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   221
        ]
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   222
      ],
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   223
      b'node': b'\n\x862\x1f\x13y\xd1\xa9\xec\xd0W\x9a"\x97z\xf7\xa5\xac\xaf\x11'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   224
    },
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   225
    b'\x00\x00\x00Q\x00\x00\x00Q\x00\x00\x00\x03a1\n'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   226
  ]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   227
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   228
Requesting multiple revisions works
39641
aa7e312375cf wireprotov2: let clients drive delta behavior
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39639
diff changeset
   229
(first revision is a fulltext since haveparents=False by default)
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   230
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   231
  $ sendhttpv2peer << EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   232
  > command filedata
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   233
  >     nodes eval:[b'\x64\x9d\x14\x9d\xf4\x3d\x83\x88\x25\x23\xb7\xfb\x1e\x6a\x3a\xf6\xf1\x90\x7b\x39', b'\x0a\x86\x32\x1f\x13\x79\xd1\xa9\xec\xd0\x57\x9a\x22\x97\x7a\xf7\xa5\xac\xaf\x11']
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   234
  >     path eval:b'a'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   235
  >     fields eval:[b'revision']
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   236
  > EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   237
  creating http peer for wire protocol version 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   238
  sending filedata command
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   239
  response: gen[
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   240
    {
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   241
      b'totalitems': 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   242
    },
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   243
    {
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   244
      b'fieldsfollowing': [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   245
        [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   246
          b'revision',
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   247
          81
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   248
        ]
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   249
      ],
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   250
      b'node': b'd\x9d\x14\x9d\xf4=\x83\x88%#\xb7\xfb\x1ej:\xf6\xf1\x90{9'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   251
    },
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   252
    b'a0\n00000000000000000000000000000000000000\n11111111111111111111111111111111111111\n',
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   253
    {
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   254
      b'deltabasenode': b'd\x9d\x14\x9d\xf4=\x83\x88%#\xb7\xfb\x1ej:\xf6\xf1\x90{9',
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   255
      b'fieldsfollowing': [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   256
        [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   257
          b'delta',
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   258
          15
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   259
        ]
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   260
      ],
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   261
      b'node': b'\n\x862\x1f\x13y\xd1\xa9\xec\xd0W\x9a"\x97z\xf7\xa5\xac\xaf\x11'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   262
    },
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   263
    b'\x00\x00\x00Q\x00\x00\x00Q\x00\x00\x00\x03a1\n'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   264
  ]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   265
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   266
Revisions are sorted by DAG order, parents first
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   267
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   268
  $ sendhttpv2peer << EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   269
  > command filedata
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   270
  >     nodes eval:[b'\x0a\x86\x32\x1f\x13\x79\xd1\xa9\xec\xd0\x57\x9a\x22\x97\x7a\xf7\xa5\xac\xaf\x11', b'\x64\x9d\x14\x9d\xf4\x3d\x83\x88\x25\x23\xb7\xfb\x1e\x6a\x3a\xf6\xf1\x90\x7b\x39']
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   271
  >     path eval:b'a'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   272
  >     fields eval:[b'revision']
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   273
  > EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   274
  creating http peer for wire protocol version 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   275
  sending filedata command
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   276
  response: gen[
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   277
    {
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   278
      b'totalitems': 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   279
    },
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   280
    {
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   281
      b'fieldsfollowing': [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   282
        [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   283
          b'revision',
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   284
          81
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   285
        ]
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   286
      ],
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   287
      b'node': b'd\x9d\x14\x9d\xf4=\x83\x88%#\xb7\xfb\x1ej:\xf6\xf1\x90{9'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   288
    },
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   289
    b'a0\n00000000000000000000000000000000000000\n11111111111111111111111111111111111111\n',
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   290
    {
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   291
      b'deltabasenode': b'd\x9d\x14\x9d\xf4=\x83\x88%#\xb7\xfb\x1ej:\xf6\xf1\x90{9',
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   292
      b'fieldsfollowing': [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   293
        [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   294
          b'delta',
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   295
          15
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   296
        ]
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   297
      ],
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   298
      b'node': b'\n\x862\x1f\x13y\xd1\xa9\xec\xd0W\x9a"\x97z\xf7\xa5\xac\xaf\x11'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   299
    },
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   300
    b'\x00\x00\x00Q\x00\x00\x00Q\x00\x00\x00\x03a1\n'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   301
  ]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   302
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   303
Requesting parents and revision data works
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   304
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   305
  $ sendhttpv2peer << EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   306
  > command filedata
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   307
  >     nodes eval:[b'\x7e\x58\x01\xb6\xd5\xf0\x3a\x5a\x54\xf3\xc4\x7b\x58\x3f\x75\x67\xaa\xd4\x3e\x5b']
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   308
  >     path eval:b'a'
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   309
  >     fields eval:[b'parents', b'revision']
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   310
  > EOF
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   311
  creating http peer for wire protocol version 2
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   312
  sending filedata command
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   313
  response: gen[
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   314
    {
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   315
      b'totalitems': 1
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   316
    },
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   317
    {
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   318
      b'fieldsfollowing': [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   319
        [
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   320
          b'revision',
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   321
          84
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   322
        ]
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   323
      ],
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   324
      b'node': b'~X\x01\xb6\xd5\xf0:ZT\xf3\xc4{X?ug\xaa\xd4>[',
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   325
      b'parents': [
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   326
        b'd\x9d\x14\x9d\xf4=\x83\x88%#\xb7\xfb\x1ej:\xf6\xf1\x90{9',
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   327
        b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
39814
d059cb669632 wireprotov2: allow multiple fields to follow revision maps
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39810
diff changeset
   328
      ]
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   329
    },
39863
c73f9f345ec0 tests: use more complex file storage test
Gregory Szorc <gregory.szorc@gmail.com>
parents: 39829
diff changeset
   330
    b'a0\n00000000000000000000000000000000000000\n11111111111111111111111111111111111111\na2\n'
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   331
  ]
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   332
40922
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   333
Linknode for duplicate revision is the initial revision
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   334
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   335
  $ sendhttpv2peer << EOF
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   336
  > command filedata
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   337
  >     nodes eval:[b'\x2e\xd2\xa3\x91\x2a\x0b\x24\x50\x20\x43\xea\xe8\x4e\xe4\xb2\x79\xc1\x8b\x90\xdd']
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   338
  >     path eval:b'dupe-file'
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   339
  >     fields eval:[b'linknode', b'parents', b'revision']
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   340
  > EOF
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   341
  creating http peer for wire protocol version 2
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   342
  sending filedata command
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   343
  response: gen[
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   344
    {
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   345
      b'totalitems': 1
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   346
    },
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   347
    {
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   348
      b'fieldsfollowing': [
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   349
        [
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   350
          b'revision',
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   351
          4
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   352
        ]
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   353
      ],
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   354
      b'linknode': b'C4\xf1\x08\x97\xd1<>\x8b\xebKcorr\xb4\xec-\x03"',
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   355
      b'node': b'.\xd2\xa3\x91*\x0b$P C\xea\xe8N\xe4\xb2y\xc1\x8b\x90\xdd',
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   356
      b'parents': [
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   357
        b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00',
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   358
        b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   359
      ]
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   360
    },
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   361
    b'foo\n'
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   362
  ]
ca6372b7e566 tests: add tests for server-side linknode adjustment with wireprotov2
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40921
diff changeset
   363
39639
0e03e6a44dee wireprotov2: define and implement "filedata" command
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
   364
  $ cat error.log