diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c --- a/mercurial/cext/parsers.c +++ b/mercurial/cext/parsers.c @@ -192,9 +192,7 @@ static inline bool dirstate_item_c_from_ static inline char dirstate_item_c_v1_state(dirstateItemObject *self) { - if (self->flags & dirstate_flag_rust_special) { - return ' '; - } else if (dirstate_item_c_removed(self)) { + if (dirstate_item_c_removed(self)) { return 'r'; } else if (dirstate_item_c_merged(self)) { return 'm'; @@ -212,9 +210,7 @@ static inline int dirstate_item_c_v1_mod static inline int dirstate_item_c_v1_size(dirstateItemObject *self) { - if (self->flags & dirstate_flag_rust_special) { - return self->size; - } else if (dirstate_item_c_merged_removed(self)) { + if (dirstate_item_c_merged_removed(self)) { return dirstate_v1_nonnormal; } else if (dirstate_item_c_from_p2_removed(self)) { return dirstate_v1_from_p2; @@ -235,9 +231,7 @@ static inline int dirstate_item_c_v1_siz static inline int dirstate_item_c_v1_mtime(dirstateItemObject *self) { - if (self->flags & dirstate_flag_rust_special) { - return self->mtime; - } else if (dirstate_item_c_removed(self)) { + if (dirstate_item_c_removed(self)) { return 0; } else if (self->flags & dirstate_flag_possibly_dirty) { return ambiguous_time; @@ -354,13 +348,6 @@ dirstate_item_from_v1_data(char state, i t->size = size; t->mtime = mtime; } - } else if (state == ' ') { - /* XXX Rust is using this special case, it should be clean up - * later. */ - t->flags = dirstate_flag_rust_special; - t->mode = mode; - t->size = size; - t->mtime = mtime; } else { PyErr_Format(PyExc_RuntimeError, "unknown state: `%c` (%d, %d, %d)", state, mode, diff --git a/mercurial/cext/util.h b/mercurial/cext/util.h --- a/mercurial/cext/util.h +++ b/mercurial/cext/util.h @@ -38,7 +38,6 @@ static const unsigned char dirstate_flag static const unsigned char dirstate_flag_merged = 1 << 4; static const unsigned char dirstate_flag_clean_p1 = 1 << 5; static const unsigned char dirstate_flag_clean_p2 = 1 << 6; -static const unsigned char dirstate_flag_rust_special = 1 << 7; extern PyTypeObject dirstateItemType; #define dirstate_tuple_check(op) (Py_TYPE(op) == &dirstateItemType) diff --git a/rust/hg-cpython/src/dirstate.rs b/rust/hg-cpython/src/dirstate.rs --- a/rust/hg-cpython/src/dirstate.rs +++ b/rust/hg-cpython/src/dirstate.rs @@ -52,25 +52,15 @@ pub fn make_dirstate_item( // because Into has a specific implementation while `as c_char` would // just do a naive enum cast. let state_code: u8 = entry.state().into(); - make_dirstate_item_raw( - py, - state_code, - entry.mode(), - entry.size(), - entry.mtime(), - ) -} -pub fn make_dirstate_item_raw( - py: Python, - state: u8, - mode: i32, - size: i32, - mtime: i32, -) -> PyResult { let make = make_dirstate_item_capi::retrieve(py)?; let maybe_obj = unsafe { - let ptr = make(state as c_char, mode, size, mtime); + let ptr = make( + state_code as c_char, + entry.mode(), + entry.size(), + entry.mtime(), + ); PyObject::from_owned_ptr_opt(py, ptr) }; maybe_obj.ok_or_else(|| PyErr::fetch(py))