tests/test-wireproto-command-pushkey.t
author Arseniy Alekseyev <aalekseyev@janestreet.com>
Thu, 17 Feb 2022 20:50:04 +0000
branchstable
changeset 48774 dcec16e799dd
parent 40048 a732d70253b0
permissions -rw-r--r--
status: fix hg status race against file deletion Differential Revision: https://phab.mercurial-scm.org/D12202
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37537
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     1
  $ . $TESTDIR/wireprotohelpers.sh
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     2
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
  $ hg init server
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     4
  $ enablehttpv2 server
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
  $ cd server
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
  $ cat >> .hg/hgrc << EOF
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
  > [web]
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
  > push_ssl = false
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
  > allow-push = *
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
  > EOF
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
  $ hg debugdrawdag << EOF
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
  > C D
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
  > |/
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
  > B
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
  > |
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
  > A
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
  > EOF
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
  $ hg serve -p $HGPORT -d --pid-file hg.pid -E error.log
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
  $ cat hg.pid > $DAEMON_PIDS
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    22
pushkey for a bookmark works
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
  $ sendhttpv2peer << EOF
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    25
  > command pushkey
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    26
  >     namespace bookmarks
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    27
  >     key @
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
  >     old
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
  >     new 426bada5c67598ca65036d57d9e4b64b0c1ce7a0
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    30
  > EOF
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
  creating http peer for wire protocol version 2
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    32
  sending pushkey command
37721
f7673845b167 wireprotov2: decode responses to their expected types
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37719
diff changeset
    33
  response: True
37537
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    34
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    35
  $ sendhttpv2peer << EOF
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    36
  > command listkeys
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    37
  >     namespace bookmarks
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
  > EOF
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
  creating http peer for wire protocol version 2
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    40
  sending listkeys command
39378
0f549da54379 stringutil: teach pprint() to indent
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
    41
  response: {
0f549da54379 stringutil: teach pprint() to indent
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
    42
    b'@': b'426bada5c67598ca65036d57d9e4b64b0c1ce7a0'
0f549da54379 stringutil: teach pprint() to indent
Gregory Szorc <gregory.szorc@gmail.com>
parents: 37725
diff changeset
    43
  }
37537
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
be5d4749edc0 wireproto: port pushkey command to wire protocol version 2
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
  $ cat error.log