rust/hg-cpython/src/dirstate/dirstate_map.rs
changeset 43173 070a38737334
parent 42960 7a01778bc7b7
child 43177 5cb8867c9e2b
equal deleted inserted replaced
43172:9145abd8b96d 43173:070a38737334
    19 use libc::c_char;
    19 use libc::c_char;
    20 
    20 
    21 use crate::{
    21 use crate::{
    22     dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator},
    22     dirstate::copymap::{CopyMap, CopyMapItemsIterator, CopyMapKeysIterator},
    23     dirstate::{decapsule_make_dirstate_tuple, dirs_multiset::Dirs},
    23     dirstate::{decapsule_make_dirstate_tuple, dirs_multiset::Dirs},
    24     ref_sharing::{PySharedRefCell, PySharedState},
    24     ref_sharing::PySharedRefCell,
    25 };
    25 };
    26 use hg::{
    26 use hg::{
    27     utils::hg_path::{HgPath, HgPathBuf},
    27     utils::hg_path::{HgPath, HgPathBuf},
    28     DirsMultiset, DirstateEntry, DirstateMap as RustDirstateMap,
    28     DirsMultiset, DirstateEntry, DirstateMap as RustDirstateMap,
    29     DirstateParents, DirstateParseError, EntryState, StateMapIter,
    29     DirstateParents, DirstateParseError, EntryState, StateMapIter,
    42 //     `RustDirstateMap`, rightfully so.
    42 //     `RustDirstateMap`, rightfully so.
    43 //     All attributes also have to have a separate refcount data attribute for
    43 //     All attributes also have to have a separate refcount data attribute for
    44 //     leaks, with all methods that go along for reference sharing.
    44 //     leaks, with all methods that go along for reference sharing.
    45 py_class!(pub class DirstateMap |py| {
    45 py_class!(pub class DirstateMap |py| {
    46     data inner: PySharedRefCell<RustDirstateMap>;
    46     data inner: PySharedRefCell<RustDirstateMap>;
    47     data py_shared_state: PySharedState;
       
    48 
    47 
    49     def __new__(_cls, _root: PyObject) -> PyResult<Self> {
    48     def __new__(_cls, _root: PyObject) -> PyResult<Self> {
    50         let inner = RustDirstateMap::default();
    49         let inner = RustDirstateMap::default();
    51         Self::create_instance(
    50         Self::create_instance(
    52             py,
    51             py,
    53             PySharedRefCell::new(inner),
    52             PySharedRefCell::new(inner),
    54             PySharedState::default()
       
    55         )
    53         )
    56     }
    54     }
    57 
    55 
    58     def clear(&self) -> PyResult<PyObject> {
    56     def clear(&self) -> PyResult<PyObject> {
    59         self.borrow_mut(py)?.clear();
    57         self.borrow_mut(py)?.clear();