Show More
@@ -192,9 +192,7 b' static inline bool dirstate_item_c_from_' | |||
|
192 | 192 | |
|
193 | 193 | static inline char dirstate_item_c_v1_state(dirstateItemObject *self) |
|
194 | 194 | { |
|
195 | if (self->flags & dirstate_flag_rust_special) { | |
|
196 | return ' '; | |
|
197 | } else if (dirstate_item_c_removed(self)) { | |
|
195 | if (dirstate_item_c_removed(self)) { | |
|
198 | 196 | return 'r'; |
|
199 | 197 | } else if (dirstate_item_c_merged(self)) { |
|
200 | 198 | return 'm'; |
@@ -212,9 +210,7 b' static inline int dirstate_item_c_v1_mod' | |||
|
212 | 210 | |
|
213 | 211 | static inline int dirstate_item_c_v1_size(dirstateItemObject *self) |
|
214 | 212 | { |
|
215 | if (self->flags & dirstate_flag_rust_special) { | |
|
216 | return self->size; | |
|
217 | } else if (dirstate_item_c_merged_removed(self)) { | |
|
213 | if (dirstate_item_c_merged_removed(self)) { | |
|
218 | 214 | return dirstate_v1_nonnormal; |
|
219 | 215 | } else if (dirstate_item_c_from_p2_removed(self)) { |
|
220 | 216 | return dirstate_v1_from_p2; |
@@ -235,9 +231,7 b' static inline int dirstate_item_c_v1_siz' | |||
|
235 | 231 | |
|
236 | 232 | static inline int dirstate_item_c_v1_mtime(dirstateItemObject *self) |
|
237 | 233 | { |
|
238 | if (self->flags & dirstate_flag_rust_special) { | |
|
239 | return self->mtime; | |
|
240 | } else if (dirstate_item_c_removed(self)) { | |
|
234 | if (dirstate_item_c_removed(self)) { | |
|
241 | 235 | return 0; |
|
242 | 236 | } else if (self->flags & dirstate_flag_possibly_dirty) { |
|
243 | 237 | return ambiguous_time; |
@@ -354,13 +348,6 b' dirstate_item_from_v1_data(char state, i' | |||
|
354 | 348 | t->size = size; |
|
355 | 349 | t->mtime = mtime; |
|
356 | 350 | } |
|
357 | } else if (state == ' ') { | |
|
358 | /* XXX Rust is using this special case, it should be clean up | |
|
359 | * later. */ | |
|
360 | t->flags = dirstate_flag_rust_special; | |
|
361 | t->mode = mode; | |
|
362 | t->size = size; | |
|
363 | t->mtime = mtime; | |
|
364 | 351 | } else { |
|
365 | 352 | PyErr_Format(PyExc_RuntimeError, |
|
366 | 353 | "unknown state: `%c` (%d, %d, %d)", state, mode, |
@@ -38,7 +38,6 b' static const unsigned char dirstate_flag' | |||
|
38 | 38 | static const unsigned char dirstate_flag_merged = 1 << 4; |
|
39 | 39 | static const unsigned char dirstate_flag_clean_p1 = 1 << 5; |
|
40 | 40 | static const unsigned char dirstate_flag_clean_p2 = 1 << 6; |
|
41 | static const unsigned char dirstate_flag_rust_special = 1 << 7; | |
|
42 | 41 | |
|
43 | 42 | extern PyTypeObject dirstateItemType; |
|
44 | 43 | #define dirstate_tuple_check(op) (Py_TYPE(op) == &dirstateItemType) |
@@ -52,25 +52,15 b' pub fn make_dirstate_item(' | |||
|
52 | 52 | // because Into<u8> has a specific implementation while `as c_char` would |
|
53 | 53 | // just do a naive enum cast. |
|
54 | 54 | let state_code: u8 = entry.state().into(); |
|
55 | make_dirstate_item_raw( | |
|
56 | py, | |
|
57 | state_code, | |
|
55 | ||
|
56 | let make = make_dirstate_item_capi::retrieve(py)?; | |
|
57 | let maybe_obj = unsafe { | |
|
58 | let ptr = make( | |
|
59 | state_code as c_char, | |
|
58 | 60 | entry.mode(), |
|
59 | 61 | entry.size(), |
|
60 | 62 | entry.mtime(), |
|
61 | ) | |
|
62 | } | |
|
63 | ||
|
64 | pub fn make_dirstate_item_raw( | |
|
65 | py: Python, | |
|
66 | state: u8, | |
|
67 | mode: i32, | |
|
68 | size: i32, | |
|
69 | mtime: i32, | |
|
70 | ) -> PyResult<PyObject> { | |
|
71 | let make = make_dirstate_item_capi::retrieve(py)?; | |
|
72 | let maybe_obj = unsafe { | |
|
73 | let ptr = make(state as c_char, mode, size, mtime); | |
|
63 | ); | |
|
74 | 64 | PyObject::from_owned_ptr_opt(py, ptr) |
|
75 | 65 | }; |
|
76 | 66 | maybe_obj.ok_or_else(|| PyErr::fetch(py)) |
General Comments 0
You need to be logged in to leave comments.
Login now