Show More
@@ -41,6 +41,11 b' class _dirstatemapcommon(object):' | |||||
41 | class, with and without Rust extensions enabled. |
|
41 | class, with and without Rust extensions enabled. | |
42 | """ |
|
42 | """ | |
43 |
|
43 | |||
|
44 | # please pytype | |||
|
45 | ||||
|
46 | _map = None | |||
|
47 | copymap = None | |||
|
48 | ||||
44 | def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2): |
|
49 | def __init__(self, ui, opener, root, nodeconstants, use_dirstate_v2): | |
45 | self._use_dirstate_v2 = use_dirstate_v2 |
|
50 | self._use_dirstate_v2 = use_dirstate_v2 | |
46 | self._nodeconstants = nodeconstants |
|
51 | self._nodeconstants = nodeconstants | |
@@ -55,6 +60,25 b' class _dirstatemapcommon(object):' | |||||
55 | # for consistent view between _pl() and _read() invocations |
|
60 | # for consistent view between _pl() and _read() invocations | |
56 | self._pendingmode = None |
|
61 | self._pendingmode = None | |
57 |
|
62 | |||
|
63 | def preload(self): | |||
|
64 | """Loads the underlying data, if it's not already loaded""" | |||
|
65 | self._map | |||
|
66 | ||||
|
67 | def get(self, key, default=None): | |||
|
68 | return self._map.get(key, default) | |||
|
69 | ||||
|
70 | def __len__(self): | |||
|
71 | return len(self._map) | |||
|
72 | ||||
|
73 | def __iter__(self): | |||
|
74 | return iter(self._map) | |||
|
75 | ||||
|
76 | def __contains__(self, key): | |||
|
77 | return key in self._map | |||
|
78 | ||||
|
79 | def __getitem__(self, item): | |||
|
80 | return self._map[item] | |||
|
81 | ||||
58 |
|
82 | |||
59 | class dirstatemap(_dirstatemapcommon): |
|
83 | class dirstatemap(_dirstatemapcommon): | |
60 | """Map encapsulating the dirstate's contents. |
|
84 | """Map encapsulating the dirstate's contents. | |
@@ -135,28 +159,9 b' class dirstatemap(_dirstatemapcommon):' | |||||
135 | for (filename, item) in self.items(): |
|
159 | for (filename, item) in self.items(): | |
136 | yield (filename, item.state, item.mode, item.size, item.mtime) |
|
160 | yield (filename, item.state, item.mode, item.size, item.mtime) | |
137 |
|
161 | |||
138 | def __len__(self): |
|
|||
139 | return len(self._map) |
|
|||
140 |
|
||||
141 | def __iter__(self): |
|
|||
142 | return iter(self._map) |
|
|||
143 |
|
||||
144 | def get(self, key, default=None): |
|
|||
145 | return self._map.get(key, default) |
|
|||
146 |
|
||||
147 | def __contains__(self, key): |
|
|||
148 | return key in self._map |
|
|||
149 |
|
||||
150 | def __getitem__(self, key): |
|
|||
151 | return self._map[key] |
|
|||
152 |
|
||||
153 | def keys(self): |
|
162 | def keys(self): | |
154 | return self._map.keys() |
|
163 | return self._map.keys() | |
155 |
|
164 | |||
156 | def preload(self): |
|
|||
157 | """Loads the underlying data, if it's not already loaded""" |
|
|||
158 | self._map |
|
|||
159 |
|
||||
160 | def _dirs_incr(self, filename, old_entry=None): |
|
165 | def _dirs_incr(self, filename, old_entry=None): | |
161 | """incremente the dirstate counter if applicable""" |
|
166 | """incremente the dirstate counter if applicable""" | |
162 | if ( |
|
167 | if ( | |
@@ -629,9 +634,6 b' if rustmod is not None:' | |||||
629 | def removefile(self, *args, **kwargs): |
|
634 | def removefile(self, *args, **kwargs): | |
630 | return self._map.removefile(*args, **kwargs) |
|
635 | return self._map.removefile(*args, **kwargs) | |
631 |
|
636 | |||
632 | def get(self, *args, **kwargs): |
|
|||
633 | return self._map.get(*args, **kwargs) |
|
|||
634 |
|
||||
635 | @property |
|
637 | @property | |
636 | def copymap(self): |
|
638 | def copymap(self): | |
637 | return self._map.copymap() |
|
639 | return self._map.copymap() | |
@@ -646,9 +648,6 b' if rustmod is not None:' | |||||
646 | """ |
|
648 | """ | |
647 | return self._map.debug_iter(all) |
|
649 | return self._map.debug_iter(all) | |
648 |
|
650 | |||
649 | def preload(self): |
|
|||
650 | self._map |
|
|||
651 |
|
||||
652 | def clear(self): |
|
651 | def clear(self): | |
653 | self._map.clear() |
|
652 | self._map.clear() | |
654 | self.setparents( |
|
653 | self.setparents( | |
@@ -664,18 +663,6 b' if rustmod is not None:' | |||||
664 | def keys(self): |
|
663 | def keys(self): | |
665 | return iter(self._map) |
|
664 | return iter(self._map) | |
666 |
|
665 | |||
667 | def __contains__(self, key): |
|
|||
668 | return key in self._map |
|
|||
669 |
|
||||
670 | def __getitem__(self, item): |
|
|||
671 | return self._map[item] |
|
|||
672 |
|
||||
673 | def __len__(self): |
|
|||
674 | return len(self._map) |
|
|||
675 |
|
||||
676 | def __iter__(self): |
|
|||
677 | return iter(self._map) |
|
|||
678 |
|
||||
679 | # forward for python2,3 compat |
|
666 | # forward for python2,3 compat | |
680 | iteritems = items |
|
667 | iteritems = items | |
681 |
|
668 |
General Comments 0
You need to be logged in to leave comments.
Login now