tests/test-wireproto-command-lookup.t
author Gregory Szorc <gregory.szorc@gmail.com>
Wed, 17 Oct 2018 17:32:15 +0200
changeset 40392 595641bd8404
parent 40048 a732d70253b0
child 45109 b1507ab0c6cf
permissions -rw-r--r--
sqlitestore: support for storing revisions without their parents This commit kinda/sorta implements the equivalent of ellipsis nodes for the SQLite storage backend. Without implementing full blown ellipsis nodes (and the necessary support for them in the wire protocol), we instead teach the store to rewrite the p1 and p2 nodes to nullid when the incoming parent isn't in the local store. This allows servers to remain dumb and send the real parent and have the clients deal with the missing parent problem. This obviously isn't ideal because a benefit of ellipsis nodes is we can insert a fake parent to ellide missing changesets. But neither solution is ideal because it drops the original parent from storage. We could probably teach the SQLite store to retain the original parent and handle missing parents at read time. However, parent revisions are stored as integers and it isn't trivial to store an "empty" revision in the store yet, which would be necessary to represent the "missing" parent. The store is somewhat intelligent in trying to remove the missing parents metadata when the revision is re-added. But, revision numbers will be all messed up in that case, so I'm not sure it is worth it. At some point we'll likely want to remove the concept of revision numbers from the database and have the store invent them at index generation time. Or even better, we can do away with revision numbers from the file storage interface completely. We'll get there eventually... Differential Revision: https://phab.mercurial-scm.org/D5168
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37538
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
  $ . $TESTDIR/wireprotohelpers.sh
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
  $ hg init server
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
  $ enablehttpv2 server
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
  $ cd server
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
  $ cat >> .hg/hgrc << EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
  > [web]
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
  > push_ssl = false
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
  > allow-push = *
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
  > EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
  $ hg debugdrawdag << EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
  > C D
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
  > |/
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
  > B
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
  > |
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
  > A
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
  > EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
  $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
  $ cat hg.pid > $DAEMON_PIDS
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    22
lookup for known node works
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
  $ sendhttpv2peer << EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    25
  > command lookup
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    26
  >     key 426bada5c67598ca65036d57d9e4b64b0c1ce7a0
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    27
  > EOF
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
  creating http peer for wire protocol version 2
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
  sending lookup command
37721
f7673845b167 wireprotov2: decode responses to their expected types
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37718
diff changeset
    30
  response: b'Bk\xad\xa5\xc6u\x98\xcae\x03mW\xd9\xe4\xb6K\x0c\x1c\xe7\xa0'
37538
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
89fed81bbb6c wireproto: port lookup to wire protocol v2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    32
  $ cat error.log