mercurial/revlogutils/constants.py
author Yuya Nishihara <yuya@tcha.org>
Fri, 07 Sep 2018 22:12:46 +0900
changeset 39468 6772cf74ff6f
parent 39330 655b5b465953
child 39506 b66ea3fc3a86
permissions -rw-r--r--
hgweb: show shortlog by default in json output (issue5978)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39329
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     1
# revlogdeltas.py - constant used for revlog logic
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     2
#
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     3
# Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     4
# Copyright 2018 Octobus <contact@octobus.net>
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     5
#
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     6
# This software may be used and distributed according to the terms of the
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     7
# GNU General Public License version 2 or any later version.
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     8
"""Helper class to compute deltas stored inside revlogs"""
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
     9
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    10
from __future__ import absolute_import
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    11
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    12
from .. import (
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    13
    util,
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    14
)
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    15
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    16
# revlog header flags
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    17
REVLOGV0 = 0
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    18
REVLOGV1 = 1
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    19
# Dummy value until file format is finalized.
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    20
# Reminder: change the bounds check in revlog.__init__ when this is changed.
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    21
REVLOGV2 = 0xDEAD
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    22
FLAG_INLINE_DATA = (1 << 16)
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    23
FLAG_GENERALDELTA = (1 << 17)
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    24
REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    25
REVLOG_DEFAULT_FORMAT = REVLOGV1
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    26
REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    27
REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    28
REVLOGV2_FLAGS = REVLOGV1_FLAGS
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    29
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    30
# revlog index flags
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    31
REVIDX_ISCENSORED = (1 << 15) # revision has censor metadata, must be verified
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    32
REVIDX_ELLIPSIS = (1 << 14) # revision hash does not match data (narrowhg)
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    33
REVIDX_EXTSTORED = (1 << 13) # revision data is stored externally
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    34
REVIDX_DEFAULT_FLAGS = 0
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    35
# stable order in which flags need to be processed and their processors applied
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    36
REVIDX_FLAGS_ORDER = [
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    37
    REVIDX_ISCENSORED,
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    38
    REVIDX_ELLIPSIS,
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    39
    REVIDX_EXTSTORED,
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    40
]
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    41
REVIDX_KNOWN_FLAGS = util.bitsfrom(REVIDX_FLAGS_ORDER)
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    42
# bitmark for flags that could cause rawdata content change
729082bb9938 revlog: split constants into a new `revlogutils.constants` module
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
    43
REVIDX_RAWTEXT_CHANGING_FLAGS = REVIDX_ISCENSORED | REVIDX_EXTSTORED