##// 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 phases,
26 phases,
27 pycompat,
27 pycompat,
28 repository,
28 repository,
29 revlog,
30 util,
29 util,
31 )
30 )
32
31
@@ -716,7 +715,7 b' def deltagroup(repo, store, nodes, ischa'
716 p1node, p2node = adjustedparents[revision.node]
715 p1node, p2node = adjustedparents[revision.node]
717 revision.p1node = p1node
716 revision.p1node = p1node
718 revision.p2node = p2node
717 revision.p2node = p2node
719 revision.flags |= revlog.REVIDX_ELLIPSIS
718 revision.flags |= repository.REVISION_FLAG_ELLIPSIS
720
719
721 else:
720 else:
722 linknode = lookup(revision.node)
721 linknode = lookup(revision.node)
@@ -4,8 +4,8 b' filelogs.'
4
4
5 There are 3 versions of changegroups: ``1``, ``2``, and ``3``. From a
5 There are 3 versions of changegroups: ``1``, ``2``, and ``3``. From a
6 high-level, versions ``1`` and ``2`` are almost exactly the same, with the
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
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
8 ``3`` adds support for storage flags in the *delta header* and optionally
9 exchanging treemanifests (enabled by setting an option on the
9 exchanging treemanifests (enabled by setting an option on the
10 ``changegroup`` part in the bundle2).
10 ``changegroup`` part in the bundle2).
11
11
@@ -127,6 +127,25 b' In version 2 and up, the delta base node'
127 changegroup. This allows the delta to be expressed against any parent,
127 changegroup. This allows the delta to be expressed against any parent,
128 which can result in smaller deltas and more efficient encoding of data.
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 Changeset Segment
149 Changeset Segment
131 =================
150 =================
132
151
@@ -30,6 +30,13 b" REPO_FEATURE_LFS = b'lfs'"
30 # Repository supports being stream cloned.
30 # Repository supports being stream cloned.
31 REPO_FEATURE_STREAM_CLONE = b'streamclone'
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 class ipeerconnection(interfaceutil.Interface):
40 class ipeerconnection(interfaceutil.Interface):
34 """Represents a "connection" to a repository.
41 """Represents a "connection" to a repository.
35
42
@@ -375,7 +382,10 b' class irevisiondelta(interfaceutil.Inter'
375 """20 byte node of the changelog revision this node is linked to.""")
382 """20 byte node of the changelog revision this node is linked to.""")
376
383
377 flags = interfaceutil.Attribute(
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 basenode = interfaceutil.Attribute(
390 basenode = interfaceutil.Attribute(
381 """20 byte node of the revision this data is a delta against.
391 """20 byte node of the revision this data is a delta against.
@@ -658,7 +668,8 b' class ifilemutation(interfaceutil.Interf'
658 The data passed in already contains a metadata header, if any.
668 The data passed in already contains a metadata header, if any.
659
669
660 ``node`` and ``flags`` can be used to define the expected node and
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 ``add()`` is usually called when adding files from e.g. the working
674 ``add()`` is usually called when adding files from e.g. the working
664 directory. ``addrevision()`` is often called by ``add()`` and for
675 directory. ``addrevision()`` is often called by ``add()`` and for
@@ -10,6 +10,7 b''
10 from __future__ import absolute_import
10 from __future__ import absolute_import
11
11
12 from .. import (
12 from .. import (
13 repository,
13 util,
14 util,
14 )
15 )
15
16
@@ -28,9 +29,16 b' REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG'
28 REVLOGV2_FLAGS = REVLOGV1_FLAGS
29 REVLOGV2_FLAGS = REVLOGV1_FLAGS
29
30
30 # revlog index flags
31 # revlog index flags
31 REVIDX_ISCENSORED = (1 << 15) # revision has censor metadata, must be verified
32
32 REVIDX_ELLIPSIS = (1 << 14) # revision hash does not match data (narrowhg)
33 # For historical reasons, revlog's internal flags were exposed via the
33 REVIDX_EXTSTORED = (1 << 13) # revision data is stored externally
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 REVIDX_DEFAULT_FLAGS = 0
42 REVIDX_DEFAULT_FLAGS = 0
35 # stable order in which flags need to be processed and their processors applied
43 # stable order in which flags need to be processed and their processors applied
36 REVIDX_FLAGS_ORDER = [
44 REVIDX_FLAGS_ORDER = [
@@ -17,7 +17,7 b' from ..node import ('
17 from .. import (
17 from .. import (
18 error,
18 error,
19 mdiff,
19 mdiff,
20 revlog,
20 repository,
21 )
21 )
22 from ..utils import (
22 from ..utils import (
23 storageutil,
23 storageutil,
@@ -874,7 +874,7 b' class ifiledatatests(basetestcase):'
874 with self._maketransactionfn() as tr:
874 with self._maketransactionfn() as tr:
875 node0 = f.add(b'foo', None, tr, 0, nullid, nullid)
875 node0 = f.add(b'foo', None, tr, 0, nullid, nullid)
876 f.addrevision(stored1, tr, 1, node0, nullid,
876 f.addrevision(stored1, tr, 1, node0, nullid,
877 flags=revlog.REVIDX_ISCENSORED)
877 flags=repository.REVISION_FLAG_CENSORED)
878
878
879 self.assertTrue(f.iscensored(1))
879 self.assertTrue(f.iscensored(1))
880
880
@@ -914,7 +914,7 b' class ifilemutationtests(basetestcase):'
914 f = self._makefilefn()
914 f = self._makefilefn()
915 with self._maketransactionfn() as tr:
915 with self._maketransactionfn() as tr:
916 for i in range(15, 0, -1):
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 flags = 1 << i
918 flags = 1 << i
919 break
919 break
920
920
@@ -371,7 +371,7 b' class filestorage(object):'
371 def iscensored(self, rev):
371 def iscensored(self, rev):
372 validaterev(rev)
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 def commonancestorsheads(self, a, b):
376 def commonancestorsheads(self, a, b):
377 validatenode(a)
377 validatenode(a)
@@ -1038,8 +1038,8 b' sub-topics can be accessed'
1038
1038
1039 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1039 There are 3 versions of changegroups: "1", "2", and "3". From a high-
1040 level, versions "1" and "2" are almost exactly the same, with the only
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"
1041 difference being an additional item in the *delta header*. Version "3"
1042 adds support for revlog flags in the *delta header* and optionally
1042 adds support for storage flags in the *delta header* and optionally
1043 exchanging treemanifests (enabled by setting an option on the
1043 exchanging treemanifests (enabled by setting an option on the
1044 "changegroup" part in the bundle2).
1044 "changegroup" part in the bundle2).
1045
1045
@@ -1162,6 +1162,27 b' sub-topics can be accessed'
1162 changegroup. This allows the delta to be expressed against any parent,
1162 changegroup. This allows the delta to be expressed against any parent,
1163 which can result in smaller deltas and more efficient encoding of data.
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 Changeset Segment
1186 Changeset Segment
1166 =================
1187 =================
1167
1188
@@ -3435,8 +3456,8 b' Sub-topic topics rendered properly'
3435 <p>
3456 <p>
3436 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3457 There are 3 versions of changegroups: &quot;1&quot;, &quot;2&quot;, and &quot;3&quot;. From a
3437 high-level, versions &quot;1&quot; and &quot;2&quot; are almost exactly the same, with the
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
3459 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
3460 &quot;3&quot; adds support for storage flags in the *delta header* and optionally
3440 exchanging treemanifests (enabled by setting an option on the
3461 exchanging treemanifests (enabled by setting an option on the
3441 &quot;changegroup&quot; part in the bundle2).
3462 &quot;changegroup&quot; part in the bundle2).
3442 </p>
3463 </p>
@@ -3582,6 +3603,24 b' Sub-topic topics rendered properly'
3582 changegroup. This allows the delta to be expressed against any parent,
3603 changegroup. This allows the delta to be expressed against any parent,
3583 which can result in smaller deltas and more efficient encoding of data.
3604 which can result in smaller deltas and more efficient encoding of data.
3584 </p>
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 <h2>Changeset Segment</h2>
3624 <h2>Changeset Segment</h2>
3586 <p>
3625 <p>
3587 The *changeset segment* consists of a single *delta group* holding
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