Show More
@@ -167,40 +167,6 b' static void dirstate_item_dealloc(PyObje' | |||||
167 | PyObject_Del(o); |
|
167 | PyObject_Del(o); | |
168 | } |
|
168 | } | |
169 |
|
169 | |||
170 | static Py_ssize_t dirstate_item_length(PyObject *o) |
|
|||
171 | { |
|
|||
172 | return 4; |
|
|||
173 | } |
|
|||
174 |
|
||||
175 | static PyObject *dirstate_item_item(PyObject *o, Py_ssize_t i) |
|
|||
176 | { |
|
|||
177 | dirstateItemObject *t = (dirstateItemObject *)o; |
|
|||
178 | switch (i) { |
|
|||
179 | case 0: |
|
|||
180 | return PyBytes_FromStringAndSize(&t->state, 1); |
|
|||
181 | case 1: |
|
|||
182 | return PyInt_FromLong(t->mode); |
|
|||
183 | case 2: |
|
|||
184 | return PyInt_FromLong(t->size); |
|
|||
185 | case 3: |
|
|||
186 | return PyInt_FromLong(t->mtime); |
|
|||
187 | default: |
|
|||
188 | PyErr_SetString(PyExc_IndexError, "index out of range"); |
|
|||
189 | return NULL; |
|
|||
190 | } |
|
|||
191 | } |
|
|||
192 |
|
||||
193 | static PySequenceMethods dirstate_item_sq = { |
|
|||
194 | dirstate_item_length, /* sq_length */ |
|
|||
195 | 0, /* sq_concat */ |
|
|||
196 | 0, /* sq_repeat */ |
|
|||
197 | dirstate_item_item, /* sq_item */ |
|
|||
198 | 0, /* sq_ass_item */ |
|
|||
199 | 0, /* sq_contains */ |
|
|||
200 | 0, /* sq_inplace_concat */ |
|
|||
201 | 0 /* sq_inplace_repeat */ |
|
|||
202 | }; |
|
|||
203 |
|
||||
204 | static PyObject *dirstate_item_v1_state(dirstateItemObject *self) |
|
170 | static PyObject *dirstate_item_v1_state(dirstateItemObject *self) | |
205 | { |
|
171 | { | |
206 | return PyBytes_FromStringAndSize(&self->state, 1); |
|
172 | return PyBytes_FromStringAndSize(&self->state, 1); | |
@@ -562,7 +528,7 b' PyTypeObject dirstateItemType = {' | |||||
562 | 0, /* tp_compare */ |
|
528 | 0, /* tp_compare */ | |
563 | 0, /* tp_repr */ |
|
529 | 0, /* tp_repr */ | |
564 | 0, /* tp_as_number */ |
|
530 | 0, /* tp_as_number */ | |
565 |
|
|
531 | 0, /* tp_as_sequence */ | |
566 | 0, /* tp_as_mapping */ |
|
532 | 0, /* tp_as_mapping */ | |
567 | 0, /* tp_hash */ |
|
533 | 0, /* tp_hash */ | |
568 | 0, /* tp_call */ |
|
534 | 0, /* tp_call */ |
@@ -223,26 +223,6 b' class DirstateItem(object):' | |||||
223 | self._size = size |
|
223 | self._size = size | |
224 | self._mtime = 0 |
|
224 | self._mtime = 0 | |
225 |
|
225 | |||
226 | def __getitem__(self, idx): |
|
|||
227 | if idx == 0 or idx == -4: |
|
|||
228 | msg = b"do not use item[x], use item.state" |
|
|||
229 | util.nouideprecwarn(msg, b'6.0', stacklevel=2) |
|
|||
230 | return self._state |
|
|||
231 | elif idx == 1 or idx == -3: |
|
|||
232 | msg = b"do not use item[x], use item.mode" |
|
|||
233 | util.nouideprecwarn(msg, b'6.0', stacklevel=2) |
|
|||
234 | return self._mode |
|
|||
235 | elif idx == 2 or idx == -2: |
|
|||
236 | msg = b"do not use item[x], use item.size" |
|
|||
237 | util.nouideprecwarn(msg, b'6.0', stacklevel=2) |
|
|||
238 | return self._size |
|
|||
239 | elif idx == 3 or idx == -1: |
|
|||
240 | msg = b"do not use item[x], use item.mtime" |
|
|||
241 | util.nouideprecwarn(msg, b'6.0', stacklevel=2) |
|
|||
242 | return self._mtime |
|
|||
243 | else: |
|
|||
244 | raise IndexError(idx) |
|
|||
245 |
|
||||
246 | @property |
|
226 | @property | |
247 | def mode(self): |
|
227 | def mode(self): | |
248 | return self._mode |
|
228 | return self._mode |
General Comments 0
You need to be logged in to leave comments.
Login now