comparison rust/hg-cpython/src/dirstate/dirstate_map.rs @ 48020:1194394510ba

rust: Remove the `rustext.parsers` module It only exported Rust implementations of the parse_dirstate and pack_dirtate functions, which are only used (anymore) when Rust is not enabled. fakedirstatewritetime.py was detecting the presence of `rustext.parsers` but what it really wants to know is whether the Rust implementation of `dirstatemap` is used. This changes it to detect `rustext.dirstate` instead. Differential Revision: https://phab.mercurial-scm.org/D11459
author Simon Sapin <simon.sapin@octobus.net>
date Mon, 20 Sep 2021 12:52:32 +0200
parents 4afd6cc447b9
children f2a9db29cb2d
comparison
equal deleted inserted replaced
48019:a83e24c3af6b 48020:1194394510ba
22 dirstate::make_dirstate_item, 22 dirstate::make_dirstate_item,
23 dirstate::make_dirstate_item_raw, 23 dirstate::make_dirstate_item_raw,
24 dirstate::non_normal_entries::{ 24 dirstate::non_normal_entries::{
25 NonNormalEntries, NonNormalEntriesIterator, 25 NonNormalEntries, NonNormalEntriesIterator,
26 }, 26 },
27 parsers::dirstate_parents_to_pytuple,
28 pybytes_deref::PyBytesDeref, 27 pybytes_deref::PyBytesDeref,
29 }; 28 };
30 use hg::{ 29 use hg::{
31 dirstate::parsers::Timestamp, 30 dirstate::parsers::Timestamp,
32 dirstate::MTIME_UNSET, 31 dirstate::MTIME_UNSET,
77 let mut map = RustDirstateMap::default(); 76 let mut map = RustDirstateMap::default();
78 let parents = map.read(bytes).map_err(|e| dirstate_error(py, e))?; 77 let parents = map.read(bytes).map_err(|e| dirstate_error(py, e))?;
79 (Box::new(map) as _, parents) 78 (Box::new(map) as _, parents)
80 }; 79 };
81 let map = Self::create_instance(py, inner)?; 80 let map = Self::create_instance(py, inner)?;
82 let parents = parents.map(|p| dirstate_parents_to_pytuple(py, &p)); 81 let parents = parents.map(|p| {
82 let p1 = PyBytes::new(py, p.p1.as_bytes());
83 let p2 = PyBytes::new(py, p.p2.as_bytes());
84 (p1, p2)
85 });
83 Ok((map, parents).to_py_object(py).into_object()) 86 Ok((map, parents).to_py_object(py).into_object())
84 } 87 }
85 88
86 /// Returns a DirstateMap 89 /// Returns a DirstateMap
87 @staticmethod 90 @staticmethod