Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGbfd65b5e070b: help: clarify overlap of revlog header and first revlog entry
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/help/internals/revlogs.txt (20 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
26a854f50ea7 | e2e507573c7c | Nathan Goldbaum | May 28 2019, 2:39 PM |
Revlogs can be modeled as 0-indexed arrays. The first revision is | Revlogs can be modeled as 0-indexed arrays. The first revision is | ||||
revision #0 and the second is revision #1. The revision -1 is typically | revision #0 and the second is revision #1. The revision -1 is typically | ||||
used to mean *does not exist* or *not defined*. | used to mean *does not exist* or *not defined*. | ||||
File Format | File Format | ||||
=========== | =========== | ||||
A revlog begins with a 32-bit big endian integer holding version info | A revlog begins with a 32-bit big endian integer holding version info | ||||
and feature flags. This integer is shared with the first revision | and feature flags. This integer overlaps with the first four bytes of | ||||
entry. | the first revision entry. | ||||
This integer is logically divided into 2 16-bit shorts. The least | This integer is logically divided into 2 16-bit shorts. The least | ||||
significant half of the integer is the format/version short. The other | significant half of the integer is the format/version short. The other | ||||
short holds feature flags that dictate behavior of the revlog. | short holds feature flags that dictate behavior of the revlog. | ||||
The following values for the format/version short are defined: | The following values for the format/version short are defined: | ||||
0 | 0 | ||||
v1 | v1 | ||||
00 01 00 01 | 00 01 00 01 | ||||
v1 + inline | v1 + inline | ||||
00 02 00 01 | 00 02 00 01 | ||||
v1 + generaldelta | v1 + generaldelta | ||||
00 03 00 01 | 00 03 00 01 | ||||
v1 + inline + generaldelta | v1 + inline + generaldelta | ||||
Following the 32-bit header is the remainder of the first index entry. | Following the 32-bit header is the remaining 60 bytes of the first index | ||||
Following that are remaining *index* data. Inlined revision data is | entry. Following that are additional *index* entries. Inlined revision | ||||
possibly located between index entries. More on this layout is described | data is possibly located between index entries. More on the this inlined | ||||
below. | layout is described below. | ||||
Version 1 Format | Version 1 Format | ||||
================ | ================ | ||||
Version 1 (RevlogNG) begins with an index describing the revisions in | Version 1 (RevlogNG) begins with an index describing the revisions in | ||||
the revlog. If the ``inline`` flag is set, revision data is stored inline, | the revlog. If the ``inline`` flag is set, revision data is stored inline, | ||||
or between index entries (as opposed to in a separate container). | or between index entries (as opposed to in a separate container). | ||||
(of length from bytes offset 8-11 from the index entry) immediately | (of length from bytes offset 8-11 from the index entry) immediately | ||||
follows the index entry. There is no header on the revision data. There | follows the index entry. There is no header on the revision data. There | ||||
is no padding between it and the index entries before and after. | is no padding between it and the index entries before and after. | ||||
If revision data is not inline, then raw revision data is stored in a | If revision data is not inline, then raw revision data is stored in a | ||||
separate byte container. The offsets from bytes 0-5 and the compressed | separate byte container. The offsets from bytes 0-5 and the compressed | ||||
length from bytes 8-11 define how to access this data. | length from bytes 8-11 define how to access this data. | ||||
The first 4 bytes of the revlog are shared between the revlog header | The 6 byte absolute offset field from the first revlog entry overlaps | ||||
and the 6 byte absolute offset field from the first revlog entry. | with the revlog header. That is, the first 6 bytes of the first revlog | ||||
entry can be split into four bytes containing the header for the revlog | |||||
file and an additional two bytes containing the offset for the first | |||||
entry. Since this is the offset from the beginning of the file for the | |||||
first revision entry, the two bytes will always be set to zero. | |||||
Version 2 Format | Version 2 Format | ||||
================ | ================ | ||||
(In development. Format not finalized or stable.) | (In development. Format not finalized or stable.) | ||||
Version 2 is identical to version 2 with the following differences. | Version 2 is identical to version 2 with the following differences. | ||||