tests/test-revlog-v2.t
author Boris Feld <boris.feld@octobus.net>
Mon, 12 Nov 2018 01:15:37 +0100
changeset 40906 27fa1d2bf484
parent 38363 a6426dd3210d
child 40919 a0886a4d6dce
permissions -rw-r--r--
test: enable sparse-revlog for test-revlog-v2.t We are about to enable sparse-revlog globally. To help with reviewing the tests change, we isolate them in individual changesets. Differential Revision: https://phab.mercurial-scm.org/D5333
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40906
27fa1d2bf484 test: enable sparse-revlog for test-revlog-v2.t
Boris Feld <boris.feld@octobus.net>
parents: 38363
diff changeset
     1
TRANSITIONAL CONFIG
27fa1d2bf484 test: enable sparse-revlog for test-revlog-v2.t
Boris Feld <boris.feld@octobus.net>
parents: 38363
diff changeset
     2
  $ cat << EOF >> $HGRCPATH
27fa1d2bf484 test: enable sparse-revlog for test-revlog-v2.t
Boris Feld <boris.feld@octobus.net>
parents: 38363
diff changeset
     3
  > [format]
27fa1d2bf484 test: enable sparse-revlog for test-revlog-v2.t
Boris Feld <boris.feld@octobus.net>
parents: 38363
diff changeset
     4
  > sparse-revlog = yes
27fa1d2bf484 test: enable sparse-revlog for test-revlog-v2.t
Boris Feld <boris.feld@octobus.net>
parents: 38363
diff changeset
     5
  > EOF
27fa1d2bf484 test: enable sparse-revlog for test-revlog-v2.t
Boris Feld <boris.feld@octobus.net>
parents: 38363
diff changeset
     6
37345
b09a25d74592 tests: disable test-revlog-v2 when using simple store
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36485
diff changeset
     7
#require reporevlogstore
b09a25d74592 tests: disable test-revlog-v2 when using simple store
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36485
diff changeset
     8
32697
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     9
A repo with unknown revlogv2 requirement string cannot be opened
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    11
  $ hg init invalidreq
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
  $ cd invalidreq
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
  $ echo exp-revlogv2.unknown >> .hg/requires
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
  $ hg log
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    15
  abort: repository requires features unknown to this Mercurial: exp-revlogv2.unknown!
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
  (see https://mercurial-scm.org/wiki/MissingRequirement for more information)
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
  [255]
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
  $ cd ..
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    19
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
Can create and open repo with revlog v2 requirement
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    21
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    22
  $ cat >> $HGRCPATH << EOF
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    23
  > [experimental]
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    24
  > revlogv2 = enable-unstable-format-and-corrupt-my-data
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    25
  > EOF
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    26
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    27
  $ hg init empty-repo
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
  $ cd empty-repo
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
  $ cat .hg/requires
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    30
  dotencode
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
  exp-revlogv2.0
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    32
  fncache
40906
27fa1d2bf484 test: enable sparse-revlog for test-revlog-v2.t
Boris Feld <boris.feld@octobus.net>
parents: 38363
diff changeset
    33
  sparserevlog
32697
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    34
  store
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    35
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    36
  $ hg log
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    37
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    38
Unknown flags to revlog are rejected
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    39
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    40
  >>> with open('.hg/store/00changelog.i', 'wb') as fh:
38363
a6426dd3210d py3: suppress the output of .write() calls in tests/test-revlog-v2.t
Pulkit Goyal <7895pulkit@gmail.com>
parents: 37345
diff changeset
    41
  ...     fh.write(b'\x00\x04\xde\xad') and None
32697
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    42
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
  $ hg log
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
  abort: unknown flags (0x04) in version 57005 revlog 00changelog.i!
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
  [255]
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    46
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    47
  $ cd ..
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    48
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    49
Writing a simple revlog v2 works
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    50
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    51
  $ hg init simple
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    52
  $ cd simple
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    53
  $ touch foo
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    54
  $ hg -q commit -A -m initial
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    55
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    56
  $ hg log
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    57
  changeset:   0:96ee1d7354c4
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    58
  tag:         tip
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    59
  user:        test
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    60
  date:        Thu Jan 01 00:00:00 1970 +0000
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    61
  summary:     initial
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    62
  
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    63
Header written as expected (changelog always disables generaldelta)
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    64
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    65
  $ f --hexdump --bytes 4 .hg/store/00changelog.i
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    66
  .hg/store/00changelog.i:
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    67
  0000: 00 01 de ad                                     |....|
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    68
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    69
  $ f --hexdump --bytes 4 .hg/store/data/foo.i
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    70
  .hg/store/data/foo.i:
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    71
  0000: 00 03 de ad                                     |....|