rust/hg-cpython/src/dirstate/dirstate_map.rs
changeset 48020 1194394510ba
parent 47954 4afd6cc447b9
child 48022 f2a9db29cb2d
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