Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 47393:7a0ec25d5836
revlog: move entry documentation alongside new related constants
Accessing individual index-entry element is usually done using integer directly.
This is presumably for "performance reasons". However as the index entry gain
more and more element it seems useful to get the option to use symbolic constant
to access item, for both clarify and versatility. We will probably keep using
integer for performance critical path, but less critical code may start using
them now that they are declared.
Differential Revision: https://phab.mercurial-scm.org/D10791
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sat, 22 May 2021 00:06:22 +0200 |
parents | 33d626910374 |
children | ac60a1366a49 |
comparison
equal
deleted
inserted
replaced
47392:8089d0fa8400 | 47393:7a0ec25d5836 |
---|---|
308 `concurrencychecker` is an optional function that receives 3 arguments: a | 308 `concurrencychecker` is an optional function that receives 3 arguments: a |
309 file handle, a filename, and an expected position. It should check whether | 309 file handle, a filename, and an expected position. It should check whether |
310 the current position in the file handle is valid, and log/warn/fail (by | 310 the current position in the file handle is valid, and log/warn/fail (by |
311 raising). | 311 raising). |
312 | 312 |
313 | 313 See mercurial/revlogutils/contants.py for details about the content of an |
314 Internal details | 314 index entry. |
315 ---------------- | |
316 | |
317 A large part of the revlog logic deals with revisions' "index entries", tuple | |
318 objects that contains the same "items" whatever the revlog version. | |
319 Different versions will have different ways of storing these items (sometimes | |
320 not having them at all), but the tuple will always be the same. New fields | |
321 are usually added at the end to avoid breaking existing code that relies | |
322 on the existing order. The field are defined as follows: | |
323 | |
324 [0] offset: | |
325 The byte index of the start of revision data chunk. | |
326 That value is shifted up by 16 bits. use "offset = field >> 16" to | |
327 retrieve it. | |
328 | |
329 flags: | |
330 A flag field that carries special information or changes the behavior | |
331 of the revision. (see `REVIDX_*` constants for details) | |
332 The flag field only occupies the first 16 bits of this field, | |
333 use "flags = field & 0xFFFF" to retrieve the value. | |
334 | |
335 [1] compressed length: | |
336 The size, in bytes, of the chunk on disk | |
337 | |
338 [2] uncompressed length: | |
339 The size, in bytes, of the full revision once reconstructed. | |
340 | |
341 [3] base rev: | |
342 Either the base of the revision delta chain (without general | |
343 delta), or the base of the delta (stored in the data chunk) | |
344 with general delta. | |
345 | |
346 [4] link rev: | |
347 Changelog revision number of the changeset introducing this | |
348 revision. | |
349 | |
350 [5] parent 1 rev: | |
351 Revision number of the first parent | |
352 | |
353 [6] parent 2 rev: | |
354 Revision number of the second parent | |
355 | |
356 [7] node id: | |
357 The node id of the current revision | |
358 | |
359 [8] sidedata offset: | |
360 The byte index of the start of the revision's side-data chunk. | |
361 | |
362 [9] sidedata chunk length: | |
363 The size, in bytes, of the revision's side-data chunk. | |
364 | |
365 [10] data compression mode: | |
366 two bits that detail the way the data chunk is compressed on disk. | |
367 (see "COMP_MODE_*" constants for details). For revlog version 0 and | |
368 1 this will always be COMP_MODE_INLINE. | |
369 | |
370 [11] side-data compression mode: | |
371 two bits that detail the way the sidedata chunk is compressed on disk. | |
372 (see "COMP_MODE_*" constants for details) | |
373 """ | 315 """ |
374 | 316 |
375 _flagserrorclass = error.RevlogError | 317 _flagserrorclass = error.RevlogError |
376 | 318 |
377 def __init__( | 319 def __init__( |