##// END OF EJS Templates
rank: actually persist revision's rank in changelog-v2...
marmoute -
r49331:c5d6c874 default
parent child Browse files
Show More
@@ -1357,10 +1357,10 b' coreconfigitem('
1357 )
1357 )
1358 # Experimental TODOs:
1358 # Experimental TODOs:
1359 #
1359 #
1360 # * Same as for evlogv2 (but for the reduction of the number of files)
1360 # * Same as for revlogv2 (but for the reduction of the number of files)
1361 # * Actually computing the rank of changesets
1361 # * Improvement to investigate
1362 # * Improvement to investigate
1362 # - storing .hgtags fnode
1363 # - storing .hgtags fnode
1363 # - storing `rank` of changesets
1364 # - storing branch related identifier
1364 # - storing branch related identifier
1365
1365
1366 coreconfigitem(
1366 coreconfigitem(
@@ -880,6 +880,12 b' class IndexObject2(IndexObject):'
880 class IndexChangelogV2(IndexObject2):
880 class IndexChangelogV2(IndexObject2):
881 index_format = revlog_constants.INDEX_ENTRY_CL_V2
881 index_format = revlog_constants.INDEX_ENTRY_CL_V2
882
882
883 null_item = (
884 IndexObject2.null_item[: revlog_constants.ENTRY_RANK]
885 + (0,) # rank of null is 0
886 + IndexObject2.null_item[revlog_constants.ENTRY_RANK :]
887 )
888
883 def _unpack_entry(self, rev, data, r=True):
889 def _unpack_entry(self, rev, data, r=True):
884 items = self.index_format.unpack(data)
890 items = self.index_format.unpack(data)
885 return (
891 return (
@@ -898,7 +904,7 b' class IndexChangelogV2(IndexObject2):'
898 items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] & 3,
904 items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] & 3,
899 (items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] >> 2)
905 (items[revlog_constants.INDEX_ENTRY_V2_IDX_COMPRESSION_MODE] >> 2)
900 & 3,
906 & 3,
901 revlog_constants.RANK_UNKNOWN,
907 items[revlog_constants.INDEX_ENTRY_V2_IDX_RANK],
902 )
908 )
903
909
904 def _pack_entry(self, rev, entry):
910 def _pack_entry(self, rev, entry):
@@ -919,6 +925,7 b' class IndexChangelogV2(IndexObject2):'
919 entry[revlog_constants.ENTRY_DATA_COMPRESSION_MODE] & 3
925 entry[revlog_constants.ENTRY_DATA_COMPRESSION_MODE] & 3
920 | (entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSION_MODE] & 3)
926 | (entry[revlog_constants.ENTRY_SIDEDATA_COMPRESSION_MODE] & 3)
921 << 2,
927 << 2,
928 entry[revlog_constants.ENTRY_RANK],
922 )
929 )
923 return self.index_format.pack(*data)
930 return self.index_format.pack(*data)
924
931
@@ -192,8 +192,9 b' assert INDEX_ENTRY_V2.size == 32 * 3, IN'
192 # 8 bytes: sidedata offset
192 # 8 bytes: sidedata offset
193 # 4 bytes: sidedata compressed length
193 # 4 bytes: sidedata compressed length
194 # 1 bytes: compression mode (2 lower bit are data_compression_mode)
194 # 1 bytes: compression mode (2 lower bit are data_compression_mode)
195 # 27 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page)
195 # 4 bytes: changeset rank (i.e. `len(::REV)`)
196 INDEX_ENTRY_CL_V2 = struct.Struct(b">Qiiii20s12xQiB27x")
196 # 23 bytes: Padding to align to 96 bytes (see RevlogV2Plan wiki page)
197 INDEX_ENTRY_CL_V2 = struct.Struct(b">Qiiii20s12xQiBi23x")
197 assert INDEX_ENTRY_CL_V2.size == 32 * 3, INDEX_ENTRY_CL_V2.size
198 assert INDEX_ENTRY_CL_V2.size == 32 * 3, INDEX_ENTRY_CL_V2.size
198 INDEX_ENTRY_V2_IDX_OFFSET = 0
199 INDEX_ENTRY_V2_IDX_OFFSET = 0
199 INDEX_ENTRY_V2_IDX_COMPRESSED_LENGTH = 1
200 INDEX_ENTRY_V2_IDX_COMPRESSED_LENGTH = 1
@@ -204,6 +205,7 b' INDEX_ENTRY_V2_IDX_NODEID = 5'
204 INDEX_ENTRY_V2_IDX_SIDEDATA_OFFSET = 6
205 INDEX_ENTRY_V2_IDX_SIDEDATA_OFFSET = 6
205 INDEX_ENTRY_V2_IDX_SIDEDATA_COMPRESSED_LENGTH = 7
206 INDEX_ENTRY_V2_IDX_SIDEDATA_COMPRESSED_LENGTH = 7
206 INDEX_ENTRY_V2_IDX_COMPRESSION_MODE = 8
207 INDEX_ENTRY_V2_IDX_COMPRESSION_MODE = 8
208 INDEX_ENTRY_V2_IDX_RANK = 9
207
209
208 # revlog index flags
210 # revlog index flags
209
211
General Comments 0
You need to be logged in to leave comments. Login now