tests/test-revlog-v2.t
author Pierre-Yves David <pierre-yves.david@octobus.net>
Thu, 22 Feb 2024 19:21:14 +0100
changeset 51422 709525b26cf5
parent 49825 2f2682f40ea0
permissions -rw-r--r--
phases: apply similar early filtering to advanceboundary advanceboundary is called the push's unbundle (but not the other unbundle) so advanceboundary did not show up the profile I looked at so far. We start with simple pre-filtering to avoid doing any work if we don't needs too.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37345
b09a25d74592 tests: disable test-revlog-v2 when using simple store
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36485
diff changeset
     1
#require reporevlogstore
b09a25d74592 tests: disable test-revlog-v2 when using simple store
Gregory Szorc <gregory.szorc@gmail.com>
parents: 36485
diff changeset
     2
32697
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     3
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
     4
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     5
  $ hg init invalidreq
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     6
  $ cd invalidreq
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     7
  $ echo exp-revlogv2.unknown >> .hg/requires
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
     8
  $ hg log
45906
95c4cca641f6 errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents: 45370
diff changeset
     9
  abort: repository requires features unknown to this Mercurial: exp-revlogv2.unknown
32697
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    10
  (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
    11
  [255]
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    12
  $ cd ..
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    13
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    14
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
    15
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    16
  $ cat >> $HGRCPATH << EOF
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    17
  > [experimental]
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    18
  > 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
    19
  > EOF
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    20
47449
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    21
  $ hg init new-repo
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    22
  $ cd new-repo
48659
6dde44bb99da test: simpler requirement matching in test-revlog-v2.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    23
  $ hg debugrequires | grep revlogv2
46704
913485776542 revlog: introduce v2 format
Raphaël Gomès <rgomes@octobus.net>
parents: 46116
diff changeset
    24
  exp-revlogv2.2
48659
6dde44bb99da test: simpler requirement matching in test-revlog-v2.t
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 48464
diff changeset
    25
  dirstate-v2 (dirstate-v2 !)
32697
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 log
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    28
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    29
Unknown flags to revlog are rejected
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    30
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    31
  >>> with open('.hg/store/00changelog.i', 'wb') as fh:
45370
15d35f2ba474 tests: make flag parsing test more future safe
Joerg Sonnenberger <joerg@bec.de>
parents: 41202
diff changeset
    32
  ...     fh.write(b'\xff\x00\xde\xad') and None
32697
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    33
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    34
  $ hg log
47157
3a9f3470922c revlog: use revlog.display_id in format related errors
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 46884
diff changeset
    35
  abort: unknown flags (0xff00) in version 57005 revlog 00changelog
46116
17a695357270 errors: use detailed exit code 50 for StorageError
Martin von Zweigbergk <martinvonz@google.com>
parents: 45906
diff changeset
    36
  [50]
32697
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
  $ cd ..
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
Writing a simple revlog v2 works
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    41
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    42
  $ hg init simple
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    43
  $ cd simple
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    44
  $ touch foo
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    45
  $ hg -q commit -A -m initial
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
  $ hg log
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    48
  changeset:   0:96ee1d7354c4
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    49
  tag:         tip
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    50
  user:        test
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    51
  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
    52
  summary:     initial
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    53
  
47324
0a3fa41fa719 revlogv2: use a unique filename for data
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47323
diff changeset
    54
41202
e7a2cc84dbc0 revlog: always enable generaldelta on version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents: 40919
diff changeset
    55
Header written as expected
32697
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    56
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    57
  $ 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
    58
  .hg/store/00changelog.i:
47261
80164d50ae3d revlogv2: no longer attempt to use inline for new revlog
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47221
diff changeset
    59
  0000: 00 00 de ad                                     |....|
32697
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    60
19b9fc40cc51 revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
    61
  $ 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
    62
  .hg/store/data/foo.i:
47261
80164d50ae3d revlogv2: no longer attempt to use inline for new revlog
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47221
diff changeset
    63
  0000: 00 00 de ad                                     |....|
47323
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    64
47342
dc3800569157 revlogv2: make sure bundling pick a compatible bundle format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47324
diff changeset
    65
Bundle use a compatible changegroup format
dc3800569157 revlogv2: make sure bundling pick a compatible bundle format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47324
diff changeset
    66
------------------------------------------
dc3800569157 revlogv2: make sure bundling pick a compatible bundle format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47324
diff changeset
    67
dc3800569157 revlogv2: make sure bundling pick a compatible bundle format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47324
diff changeset
    68
  $ hg bundle --all ../basic.hg
dc3800569157 revlogv2: make sure bundling pick a compatible bundle format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47324
diff changeset
    69
  1 changesets found
dc3800569157 revlogv2: make sure bundling pick a compatible bundle format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47324
diff changeset
    70
  $ hg debugbundle --spec ../basic.hg
dc3800569157 revlogv2: make sure bundling pick a compatible bundle format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47324
diff changeset
    71
  bzip2-v2
dc3800569157 revlogv2: make sure bundling pick a compatible bundle format
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47324
diff changeset
    72
47323
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    73
The expected files are generated
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    74
--------------------------------
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    75
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    76
We should have have:
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    77
- a docket
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    78
- a index file with a unique name
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    79
- a data file
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    80
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    81
  $ ls .hg/store/00changelog* .hg/store/00manifest*
47389
e6292eb33384 revlog: store sidedata in their own file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47342
diff changeset
    82
  .hg/store/00changelog-1335303a.sda
e6292eb33384 revlog: store sidedata in their own file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47342
diff changeset
    83
  .hg/store/00changelog-6b8ab34b.idx
e6292eb33384 revlog: store sidedata in their own file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47342
diff changeset
    84
  .hg/store/00changelog-b875dfc5.dat
47323
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    85
  .hg/store/00changelog.i
47389
e6292eb33384 revlog: store sidedata in their own file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47342
diff changeset
    86
  .hg/store/00manifest-05a21d65.idx
e6292eb33384 revlog: store sidedata in their own file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47342
diff changeset
    87
  .hg/store/00manifest-43c37dde.dat
e6292eb33384 revlog: store sidedata in their own file
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47342
diff changeset
    88
  .hg/store/00manifest-e2c9362a.sda
47323
f612db768c7a revlogv2: use a unique filename for index
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47279
diff changeset
    89
  .hg/store/00manifest.i
47449
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    90
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    91
Local clone works
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    92
-----------------
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    93
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    94
  $ hg clone . ../cloned-repo
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    95
  updating to branch default
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    96
  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    97
  $ hg tip | tee ../tip-new
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    98
  changeset:   0:96ee1d7354c4
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
    99
  tag:         tip
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   100
  user:        test
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   101
  date:        Thu Jan 01 00:00:00 1970 +0000
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   102
  summary:     initial
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   103
  
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   104
  $ hg tip -R ../cloned-repo | tee ../tip-cloned
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   105
  changeset:   0:96ee1d7354c4
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   106
  tag:         tip
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   107
  user:        test
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   108
  date:        Thu Jan 01 00:00:00 1970 +0000
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   109
  summary:     initial
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   110
  
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   111
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   112
The two repository should be identical, this diff MUST be empty
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   113
da3fb8c10caa revlogv2: also test that local clone works
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47389
diff changeset
   114
  $ cmp ../tip-new ../tip-cloned || diff -U8 ../tip-new ../tip-cloned
47450
9cecc222c536 revlogv2: fix `hg verify` with revlog v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47449
diff changeset
   115
9cecc222c536 revlogv2: fix `hg verify` with revlog v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47449
diff changeset
   116
9cecc222c536 revlogv2: fix `hg verify` with revlog v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47449
diff changeset
   117
hg verify should be happy
9cecc222c536 revlogv2: fix `hg verify` with revlog v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47449
diff changeset
   118
-------------------------
9cecc222c536 revlogv2: fix `hg verify` with revlog v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47449
diff changeset
   119
49825
2f2682f40ea0 tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents: 48659
diff changeset
   120
  $ hg verify -q
47450
9cecc222c536 revlogv2: fix `hg verify` with revlog v2
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 47449
diff changeset
   121
49825
2f2682f40ea0 tests: use the `--quiet` flag for verify when applicable
Raphaël Gomès <rgomes@octobus.net>
parents: 48659
diff changeset
   122
  $ hg verify -R ../cloned-repo -q