Mercurial > hg
annotate tests/test-revlog-v2.t @ 46358:009130064813
exchangev2: avoid second look-up by node
Accessing the revlog by node is slightly more expensive than by
revision, so look up the revision first and use it afterwards.
Differential Revision: https://phab.mercurial-scm.org/D9831
author | Joerg Sonnenberger <joerg@bec.de> |
---|---|
date | Tue, 19 Jan 2021 00:20:42 +0100 |
parents | 17a695357270 |
children | 913485776542 |
rev | line source |
---|---|
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 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
21 $ hg init empty-repo |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
22 $ cd empty-repo |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
23 $ cat .hg/requires |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
24 dotencode |
41202
e7a2cc84dbc0
revlog: always enable generaldelta on version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40919
diff
changeset
|
25 exp-revlogv2.1 |
32697
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 fncache |
40906
27fa1d2bf484
test: enable sparse-revlog for test-revlog-v2.t
Boris Feld <boris.feld@octobus.net>
parents:
38363
diff
changeset
|
27 sparserevlog |
32697
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
28 store |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
29 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
30 $ hg log |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
31 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
32 Unknown flags to revlog are rejected |
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 >>> 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
|
35 ... 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
|
36 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
37 $ hg log |
45906
95c4cca641f6
errors: remove trailing "!" from some error messages for consistency
Martin von Zweigbergk <martinvonz@google.com>
parents:
45370
diff
changeset
|
38 abort: unknown flags (0xff00) in version 57005 revlog 00changelog.i |
46116
17a695357270
errors: use detailed exit code 50 for StorageError
Martin von Zweigbergk <martinvonz@google.com>
parents:
45906
diff
changeset
|
39 [50] |
32697
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
40 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
41 $ cd .. |
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 Writing a simple revlog v2 works |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
44 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
45 $ hg init simple |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
46 $ cd simple |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
47 $ touch foo |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
48 $ hg -q commit -A -m initial |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
49 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
50 $ hg log |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
51 changeset: 0:96ee1d7354c4 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
52 tag: tip |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
53 user: test |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
54 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
|
55 summary: initial |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
56 |
41202
e7a2cc84dbc0
revlog: always enable generaldelta on version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40919
diff
changeset
|
57 Header written as expected |
32697
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
58 |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
59 $ 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
|
60 .hg/store/00changelog.i: |
19b9fc40cc51
revlog: skeleton support for version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
61 0000: 00 01 de ad |....| |
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 $ 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
|
64 .hg/store/data/foo.i: |
41202
e7a2cc84dbc0
revlog: always enable generaldelta on version 2 revlogs
Gregory Szorc <gregory.szorc@gmail.com>
parents:
40919
diff
changeset
|
65 0000: 00 01 de ad |....| |