##// END OF EJS Templates
repository: define and use revision flag constants...
Gregory Szorc -
r40083:8e398628 default
parent child Browse files
Show More
@@ -26,7 +26,6 b' from . import ('
26 26 phases,
27 27 pycompat,
28 28 repository,
29 revlog,
30 29 util,
31 30 )
32 31
@@ -716,7 +715,7 b' def deltagroup(repo, store, nodes, ischa'
716 715 p1node, p2node = adjustedparents[revision.node]
717 716 revision.p1node = p1node
718 717 revision.p2node = p2node
719 revision.flags |= revlog.REVIDX_ELLIPSIS
718 revision.flags |= repository.REVISION_FLAG_ELLIPSIS
720 719
721 720 else:
722 721 linknode = lookup(revision.node)
@@ -4,8 +4,8 b' filelogs.'
4 4
5 5 There are 3 versions of changegroups: ``1``, ``2``, and ``3``. From a
6 6 high-level, versions ``1`` and ``2`` are almost exactly the same, with the
7 only difference being an additional item in the *delta header*. Version
8 ``3`` adds support for revlog flags in the *delta header* and optionally
7 only difference being an additional item in the *delta header*. Version
8 ``3`` adds support for storage flags in the *delta header* and optionally
9 9 exchanging treemanifests (enabled by setting an option on the
10 10 ``changegroup`` part in the bundle2).
11 11
@@ -127,6 +127,25 b' In version 2 and up, the delta base node'
127 127 changegroup. This allows the delta to be expressed against any parent,
128 128 which can result in smaller deltas and more efficient encoding of data.
129 129
130 The *flags* field holds bitwise flags affecting the processing of revision
131 data. The following flags are defined:
132
133 32768
134 Censored revision. The revision's fulltext has been replaced by censor
135 metadata. May only occur on file revisions.
136 16384
137 Ellipsis revision. Revision hash does not match data (likely due to rewritten
138 parents).
139 8192
140 Externally stored. The revision fulltext contains ``key:value`` ``\n``
141 delimited metadata defining an object stored elsewhere. Used by the LFS
142 extension.
143
144 For historical reasons, the integer values are identical to revlog version 1
145 per-revision storage flags and correspond to bits being set in this 2-byte
146 field. Bits were allocated starting from the most-significant bit, hence the
147 reverse ordering and allocation of these flags.
148
130 149 Changeset Segment
131 150 =================
132 151
@@ -30,6 +30,13 b" REPO_FEATURE_LFS = b'lfs'"
30 30 # Repository supports being stream cloned.
31 31 REPO_FEATURE_STREAM_CLONE = b'streamclone'
32 32
33 REVISION_FLAG_CENSORED = 1 << 15
34 REVISION_FLAG_ELLIPSIS = 1 << 14
35 REVISION_FLAG_EXTSTORED = 1 << 13
36
37 REVISION_FLAGS_KNOWN = (
38 REVISION_FLAG_CENSORED | REVISION_FLAG_ELLIPSIS | REVISION_FLAG_EXTSTORED)
39
33 40 class ipeerconnection(interfaceutil.Interface):
34 41 """Represents a "connection" to a repository.
35 42
@@ -375,7 +382,10 b' class irevisiondelta(interfaceutil.Inter'
375 382 """20 byte node of the changelog revision this node is linked to.""")
376 383
377 384 flags = interfaceutil.Attribute(
378 """2 bytes of integer flags that apply to this revision.""")
385 """2 bytes of integer flags that apply to this revision.
386
387 This is a bitwise composition of the ``REVISION_FLAG_*`` constants.
388 """)
379 389
380 390 basenode = interfaceutil.Attribute(
381 391 """20 byte node of the revision this data is a delta against.
@@ -658,7 +668,8 b' class ifilemutation(interfaceutil.Interf'
658 668 The data passed in already contains a metadata header, if any.
659 669
660 670 ``node`` and ``flags`` can be used to define the expected node and
661 the flags to use with storage.
671 the flags to use with storage. ``flags`` is a bitwise value composed
672 of the various ``REVISION_FLAG_*`` constants.
662 673
663 674 ``add()`` is usually called when adding files from e.g. the working
664 675 directory. ``addrevision()`` is often called by ``add()`` and for
@@ -10,6 +10,7 b''
10 10 from __future__ import absolute_import
11 11
12 12 from .. import (
13 repository,
13 14 util,
14 15 )
15 16
@@ -28,9 +29,16 b' REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG'
28 29 REVLOGV2_FLAGS = REVLOGV1_FLAGS
29 30
30 31 # 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
32
33 # For historical reasons, revlog's internal flags were exposed via the
34 # wire protocol and are even exposed in parts of the storage APIs.
35
36 # revision has censor metadata, must be verified
37 REVIDX_ISCENSORED = repository.REVISION_FLAG_CENSORED
38 # revision hash does not match data (narrowhg)
39 REVIDX_ELLIPSIS = repository.REVISION_FLAG_ELLIPSIS
40 # revision data is stored externally
41 REVIDX_EXTSTORED = repository.REVISION_FLAG_EXTSTORED
34 42 REVIDX_DEFAULT_FLAGS = 0
35 43 # stable order in which flags need to be processed and their processors applied
36 44 REVIDX_FLAGS_ORDER = [
@@ -17,7 +17,7 b' from ..node import ('
17 17 from .. import (
18 18 error,
19 19 mdiff,
20 revlog,
20 repository,
21 21 )
22 22 from ..utils import (
23 23 storageutil,
@@ -874,7 +874,7 b' class ifiledatatests(basetestcase):'
874 874 with self._maketransactionfn() as tr:
875 875 node0 = f.add(b'foo', None, tr, 0, nullid, nullid)
876 876 f.addrevision(stored1, tr, 1, node0, nullid,
877 flags=revlog.REVIDX_ISCENSORED)
877 flags=repository.REVISION_FLAG_CENSORED)
878 878
879 879 self.assertTrue(f.iscensored(1))
880 880
@@ -914,7 +914,7 b' class ifilemutationtests(basetestcase):'
914 914 f = self._makefilefn()
915 915 with self._maketransactionfn() as tr:
916 916 for i in range(15, 0, -1):
917 if (1 << i) & ~revlog.REVIDX_KNOWN_FLAGS:
917 if (1 << i) & ~repository.REVISION_FLAGS_KNOWN:
918 918 flags = 1 << i
919 919 break
920 920
@@ -371,7 +371,7 b' class filestorage(object):'
371 371 def iscensored(self, rev):
372 372 validaterev(rev)
373 373
374 return self._flags(rev) & revlog.REVIDX_ISCENSORED
374 return self._flags(rev) & repository.REVISION_FLAG_CENSORED
375 375
376 376 def commonancestorsheads(self, a, b):
377 377 validatenode(a)
@@ -1038,8 +1038,8 b' sub-topics can be accessed'
1038 1038
1039 1039 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1040 1040 level, versions "1" and "2" are almost exactly the same, with the only
1041 difference being an additional item in the *delta header*. Version "3"
1042 adds support for revlog flags in the *delta header* and optionally
1041 difference being an additional item in the *delta header*. Version "3"
1042 adds support for storage flags in the *delta header* and optionally
1043 1043 exchanging treemanifests (enabled by setting an option on the
1044 1044 "changegroup" part in the bundle2).
1045 1045
@@ -1162,6 +1162,27 b' sub-topics can be accessed'
1162 1162 changegroup. This allows the delta to be expressed against any parent,
1163 1163 which can result in smaller deltas and more efficient encoding of data.
1164 1164
1165 The *flags* field holds bitwise flags affecting the processing of revision
1166 data. The following flags are defined:
1167
1168 32768
1169 Censored revision. The revision's fulltext has been replaced by censor
1170 metadata. May only occur on file revisions.
1171
1172 16384
1173 Ellipsis revision. Revision hash does not match data (likely due to
1174 rewritten parents).
1175
1176 8192
1177 Externally stored. The revision fulltext contains "key:value" "\n"
1178 delimited metadata defining an object stored elsewhere. Used by the LFS
1179 extension.
1180
1181 For historical reasons, the integer values are identical to revlog version
1182 1 per-revision storage flags and correspond to bits being set in this
1183 2-byte field. Bits were allocated starting from the most-significant bit,
1184 hence the reverse ordering and allocation of these flags.
1185
1165 1186 Changeset Segment
1166 1187 =================
1167 1188
@@ -3435,8 +3456,8 b' Sub-topic topics rendered properly'
3435 3456 <p>
3436 3457 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3437 3458 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
3438 only difference being an additional item in the *delta header*. Version
3439 &quot;3&quot; adds support for revlog flags in the *delta header* and optionally
3459 only difference being an additional item in the *delta header*. Version
3460 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3440 3461 exchanging treemanifests (enabled by setting an option on the
3441 3462 &quot;changegroup&quot; part in the bundle2).
3442 3463 </p>
@@ -3582,6 +3603,24 b' Sub-topic topics rendered properly'
3582 3603 changegroup. This allows the delta to be expressed against any parent,
3583 3604 which can result in smaller deltas and more efficient encoding of data.
3584 3605 </p>
3606 <p>
3607 The *flags* field holds bitwise flags affecting the processing of revision
3608 data. The following flags are defined:
3609 </p>
3610 <dl>
3611 <dt>32768
3612 <dd>Censored revision. The revision's fulltext has been replaced by censor metadata. May only occur on file revisions.
3613 <dt>16384
3614 <dd>Ellipsis revision. Revision hash does not match data (likely due to rewritten parents).
3615 <dt>8192
3616 <dd>Externally stored. The revision fulltext contains &quot;key:value&quot; &quot;\n&quot; delimited metadata defining an object stored elsewhere. Used by the LFS extension.
3617 </dl>
3618 <p>
3619 For historical reasons, the integer values are identical to revlog version 1
3620 per-revision storage flags and correspond to bits being set in this 2-byte
3621 field. Bits were allocated starting from the most-significant bit, hence the
3622 reverse ordering and allocation of these flags.
3623 </p>
3585 3624 <h2>Changeset Segment</h2>
3586 3625 <p>
3587 3626 The *changeset segment* consists of a single *delta group* holding
General Comments 0
You need to be logged in to leave comments. Login now