| 1 |
A repo with unknown revlogv2 requirement string cannot be opened |
| 2 |
|
| 3 |
$ hg init invalidreq |
| 4 |
$ cd invalidreq |
| 5 |
$ echo exp-revlogv2.unknown >> .hg/requires |
| 6 |
$ hg log |
| 7 |
abort: repository requires features unknown to this Mercurial: exp-revlogv2.unknown |
| 8 |
(see https://mercurial-scm.org/wiki/MissingRequirement for more information) |
| 9 |
[255] |
| 10 |
$ cd .. |
| 11 |
|
| 12 |
Can create and open repo with revlog v2 requirement |
| 13 |
|
| 14 |
$ cat >> $HGRCPATH << EOF |
| 15 |
> [experimental] |
| 16 |
> revlogv2 = enable-unstable-format-and-corrupt-my-data |
| 17 |
> [storage] |
| 18 |
> fileindex.slow-path=allow |
| 19 |
> EOF |
| 20 |
|
| 21 |
$ hg init new-repo |
| 22 |
$ cd new-repo |
| 23 |
$ hg debugrequires | grep revlogv2 |
| 24 |
exp-revlogv2.2 |
| 25 |
dirstate-v2 (dirstate-v2 !) |
| 26 |
|
| 27 |
$ hg log |
| 28 |
|
| 29 |
Unknown flags to revlog are rejected |
| 30 |
|
| 31 |
>>> with open('.hg/store/00changelog.i', 'wb') as fh: |
| 32 |
... fh.write(b'\xff\x00\xde\xad') and None |
| 33 |
|
| 34 |
$ hg log |
| 35 |
abort: unknown flags (0xff00) in version 57005 revlog 00changelog |
| 36 |
[50] |
| 37 |
|
| 38 |
$ cd .. |
| 39 |
|
| 40 |
Writing a simple revlog v2 works |
| 41 |
|
| 42 |
$ hg init simple |
| 43 |
$ cd simple |
| 44 |
$ touch foo |
| 45 |
$ hg -q commit -A -m initial |
| 46 |
|
| 47 |
$ hg log |
| 48 |
changeset: 0:96ee1d7354c4 |
| 49 |
tag: tip |
| 50 |
user: test |
| 51 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 52 |
summary: initial |
| 53 |
|
| 54 |
|
| 55 |
Header written as expected |
| 56 |
|
| 57 |
$ f --hexdump --bytes 4 .hg/store/00changelog.i |
| 58 |
.hg/store/00changelog.i: |
| 59 |
0000: 00 00 de ad |....| |
| 60 |
|
| 61 |
$ f --hexdump --bytes 4 .hg/store/data/foo.i |
| 62 |
.hg/store/data/foo.i: |
| 63 |
0000: 00 00 de ad |....| |
| 64 |
|
| 65 |
Bundle use a compatible changegroup format |
| 66 |
------------------------------------------ |
| 67 |
|
| 68 |
$ hg bundle --all ../basic.hg |
| 69 |
1 changesets found |
| 70 |
$ hg debugbundle --spec ../basic.hg |
| 71 |
bzip2-v2 |
| 72 |
|
| 73 |
The expected files are generated |
| 74 |
-------------------------------- |
| 75 |
|
| 76 |
We should have have: |
| 77 |
- a docket |
| 78 |
- a index file with a unique name |
| 79 |
- a data file |
| 80 |
|
| 81 |
$ ls .hg/store/00changelog* .hg/store/00manifest* |
| 82 |
.hg/store/00changelog-1335303a.sda |
| 83 |
.hg/store/00changelog-6b8ab34b.idx |
| 84 |
.hg/store/00changelog-b875dfc5.dat |
| 85 |
.hg/store/00changelog.i |
| 86 |
.hg/store/00manifest-05a21d65.idx |
| 87 |
.hg/store/00manifest-43c37dde.dat |
| 88 |
.hg/store/00manifest-e2c9362a.sda |
| 89 |
.hg/store/00manifest.i |
| 90 |
|
| 91 |
Local clone works |
| 92 |
----------------- |
| 93 |
|
| 94 |
$ hg clone . ../cloned-repo |
| 95 |
updating to branch default |
| 96 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 97 |
$ hg tip | tee ../tip-new |
| 98 |
changeset: 0:96ee1d7354c4 |
| 99 |
tag: tip |
| 100 |
user: test |
| 101 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 102 |
summary: initial |
| 103 |
|
| 104 |
$ hg tip -R ../cloned-repo | tee ../tip-cloned |
| 105 |
changeset: 0:96ee1d7354c4 |
| 106 |
tag: tip |
| 107 |
user: test |
| 108 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 109 |
summary: initial |
| 110 |
|
| 111 |
|
| 112 |
The two repository should be identical, this diff MUST be empty |
| 113 |
|
| 114 |
$ cmp ../tip-new ../tip-cloned || diff -U8 ../tip-new ../tip-cloned |
| 115 |
|
| 116 |
|
| 117 |
hg verify should be happy |
| 118 |
------------------------- |
| 119 |
|
| 120 |
$ hg verify -q |
| 121 |
|
| 122 |
$ hg verify -R ../cloned-repo -q |