##// END OF EJS Templates
revlog: directly use the Struct object for related operation...
marmoute -
r47619:1dc86c2a default
parent child Browse files
Show More
@@ -44,7 +44,7 b' def offset_type(offset, type):'
44
44
45 class BaseIndexObject(object):
45 class BaseIndexObject(object):
46 # Format of an index entry according to Python's `struct` language
46 # Format of an index entry according to Python's `struct` language
47 index_format = revlog_constants.INDEX_ENTRY_V1.format
47 index_format = revlog_constants.INDEX_ENTRY_V1
48 # Size of a C unsigned long long int, platform independent
48 # Size of a C unsigned long long int, platform independent
49 big_int_size = struct.calcsize(b'>Q')
49 big_int_size = struct.calcsize(b'>Q')
50 # Size of a C long int, platform independent
50 # Size of a C long int, platform independent
@@ -99,7 +99,7 b' class BaseIndexObject(object):'
99 def append(self, tup):
99 def append(self, tup):
100 if '_nodemap' in vars(self):
100 if '_nodemap' in vars(self):
101 self._nodemap[tup[7]] = len(self)
101 self._nodemap[tup[7]] = len(self)
102 data = _pack(self.index_format, *tup)
102 data = self.index_format.pack(*tup)
103 self._extra.append(data)
103 self._extra.append(data)
104
104
105 def _check_index(self, i):
105 def _check_index(self, i):
@@ -117,7 +117,7 b' class BaseIndexObject(object):'
117 else:
117 else:
118 index = self._calculate_index(i)
118 index = self._calculate_index(i)
119 data = self._data[index : index + self.index_size]
119 data = self._data[index : index + self.index_size]
120 r = _unpack(self.index_format, data)
120 r = self.index_format.unpack(data)
121 if self._lgt and i == 0:
121 if self._lgt and i == 0:
122 r = (offset_type(0, gettype(r[0])),) + r[1:]
122 r = (offset_type(0, gettype(r[0])),) + r[1:]
123 return r
123 return r
@@ -243,7 +243,7 b' def parse_index2(data, inline, revlogv2='
243
243
244
244
245 class Index2Mixin(object):
245 class Index2Mixin(object):
246 index_format = revlog_constants.INDEX_ENTRY_V2.format
246 index_format = revlog_constants.INDEX_ENTRY_V2
247 index_size = revlog_constants.INDEX_ENTRY_V2.size
247 index_size = revlog_constants.INDEX_ENTRY_V2.size
248 null_item = (0, 0, 0, -1, -1, -1, -1, nullid, 0, 0)
248 null_item = (0, 0, 0, -1, -1, -1, -1, nullid, 0, 0)
249
249
General Comments 0
You need to be logged in to leave comments. Login now