Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlogutils/constants.py @ 39356:729082bb9938
revlog: split constants into a new `revlogutils.constants` module
We want to split some logic out of the main revlog file (the delta computing
logic). However, this logic needs access to multiple constants related to the
revlog. So we move all revlog related constants into a new module that could
be imported from multiple places.
We don't copy the file (preserving blame history) because there are only a few
moving lines. Also, copying the file would result in annoying merge conflicts
with ongoing work from others contributors.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 16 Aug 2018 02:08:13 +0200 |
parents | |
children | 655b5b465953 |
comparison
equal
deleted
inserted
replaced
39355:94a4980695f8 | 39356:729082bb9938 |
---|---|
1 # revlogdeltas.py - constant used for revlog logic | |
2 # | |
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
4 # Copyright 2018 Octobus <contact@octobus.net> | |
5 # | |
6 # This software may be used and distributed according to the terms of the | |
7 # GNU General Public License version 2 or any later version. | |
8 """Helper class to compute deltas stored inside revlogs""" | |
9 | |
10 from __future__ import absolute_import | |
11 | |
12 from .. import ( | |
13 util, | |
14 ) | |
15 | |
16 # revlog header flags | |
17 REVLOGV0 = 0 | |
18 REVLOGV1 = 1 | |
19 # Dummy value until file format is finalized. | |
20 # Reminder: change the bounds check in revlog.__init__ when this is changed. | |
21 REVLOGV2 = 0xDEAD | |
22 FLAG_INLINE_DATA = (1 << 16) | |
23 FLAG_GENERALDELTA = (1 << 17) | |
24 REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA | |
25 REVLOG_DEFAULT_FORMAT = REVLOGV1 | |
26 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS | |
27 REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA | |
28 REVLOGV2_FLAGS = REVLOGV1_FLAGS | |
29 | |
30 # revlog index flags | |
31 REVIDX_ISCENSORED = (1 << 15) # revision has censor metadata, must be verified | |
32 REVIDX_ELLIPSIS = (1 << 14) # revision hash does not match data (narrowhg) | |
33 REVIDX_EXTSTORED = (1 << 13) # revision data is stored externally | |
34 REVIDX_DEFAULT_FLAGS = 0 | |
35 # stable order in which flags need to be processed and their processors applied | |
36 REVIDX_FLAGS_ORDER = [ | |
37 REVIDX_ISCENSORED, | |
38 REVIDX_ELLIPSIS, | |
39 REVIDX_EXTSTORED, | |
40 ] | |
41 REVIDX_KNOWN_FLAGS = util.bitsfrom(REVIDX_FLAGS_ORDER) | |
42 # bitmark for flags that could cause rawdata content change | |
43 REVIDX_RAWTEXT_CHANGING_FLAGS = REVIDX_ISCENSORED | REVIDX_EXTSTORED | |
44 | |
45 # maximum <delta-chain-data>/<revision-text-length> ratio | |
46 LIMIT_DELTA2TEXT = 2 |