12 use cpython::{ |
12 use cpython::{ |
13 exc, PyBytes, PyDict, PyErr, PyInt, PyModule, PyResult, PyTuple, Python, |
13 exc, PyBytes, PyDict, PyErr, PyInt, PyModule, PyResult, PyTuple, Python, |
14 PythonObject, ToPyObject, |
14 PythonObject, ToPyObject, |
15 }; |
15 }; |
16 use hg::{ |
16 use hg::{ |
17 pack_dirstate, parse_dirstate, utils::hg_path::HgPathBuf, DirstateEntry, |
17 dirstate::parsers::Timestamp, pack_dirstate, parse_dirstate, |
18 DirstateParents, FastHashMap, PARENT_SIZE, |
18 utils::hg_path::HgPathBuf, DirstateEntry, DirstateParents, FastHashMap, |
|
19 PARENT_SIZE, |
19 }; |
20 }; |
20 use std::convert::TryInto; |
21 use std::convert::TryInto; |
21 |
22 |
22 use crate::dirstate::{extract_dirstate, make_dirstate_tuple}; |
23 use crate::dirstate::{extract_dirstate, make_dirstate_tuple}; |
23 use std::time::Duration; |
|
24 |
24 |
25 fn parse_dirstate_wrapper( |
25 fn parse_dirstate_wrapper( |
26 py: Python, |
26 py: Python, |
27 dmap: PyDict, |
27 dmap: PyDict, |
28 copymap: PyDict, |
28 copymap: PyDict, |
96 &copies?, |
96 &copies?, |
97 DirstateParents { |
97 DirstateParents { |
98 p1: p1.try_into().unwrap(), |
98 p1: p1.try_into().unwrap(), |
99 p2: p2.try_into().unwrap(), |
99 p2: p2.try_into().unwrap(), |
100 }, |
100 }, |
101 Duration::from_secs(now.as_object().extract::<u64>(py)?), |
101 Timestamp(now.as_object().extract::<u64>(py)?), |
102 ) { |
102 ) { |
103 Ok(packed) => { |
103 Ok(packed) => { |
104 for (filename, entry) in dirstate_map.iter() { |
104 for (filename, entry) in dirstate_map.iter() { |
105 dmap.set_item( |
105 dmap.set_item( |
106 py, |
106 py, |