equal
deleted
inserted
replaced
8 from __future__ import absolute_import |
8 from __future__ import absolute_import |
9 |
9 |
10 import struct |
10 import struct |
11 import zlib |
11 import zlib |
12 |
12 |
13 from ..node import nullid |
13 from ..node import nullid, nullrev |
14 from .. import pycompat |
14 from .. import ( |
|
15 pycompat, |
|
16 revlogutils, |
|
17 util, |
|
18 ) |
15 |
19 |
16 stringio = pycompat.bytesio |
20 stringio = pycompat.bytesio |
17 |
21 |
18 |
22 |
19 _pack = struct.pack |
23 _pack = struct.pack |
41 def offset_type(offset, type): |
45 def offset_type(offset, type): |
42 return int(int(offset) << 16 | type) |
46 return int(int(offset) << 16 | type) |
43 |
47 |
44 |
48 |
45 class BaseIndexObject(object): |
49 class BaseIndexObject(object): |
|
50 @util.propertycache |
|
51 def nodemap(self): |
|
52 nodemap = revlogutils.NodeMap({nullid: nullrev}) |
|
53 for r in range(0, len(self)): |
|
54 n = self[r][7] |
|
55 nodemap[n] = r |
|
56 return nodemap |
|
57 |
|
58 def clearcaches(self): |
|
59 self.__dict__.pop('nodemap', None) |
|
60 |
46 def __len__(self): |
61 def __len__(self): |
47 return self._lgt + len(self._extra) |
62 return self._lgt + len(self._extra) |
48 |
63 |
49 def append(self, tup): |
64 def append(self, tup): |
50 self._extra.append(tup) |
65 self._extra.append(tup) |