rust/hg-cpython/src/update.rs
branchstable
changeset 52186 e6a44bc91bc2
parent 52056 8b7123c8947b
child 52213 96b113d22b34
equal deleted inserted replaced
52185:e698e3e75420 52186:e6a44bc91bc2
    20 
    20 
    21 pub fn update_from_null_fast_path(
    21 pub fn update_from_null_fast_path(
    22     py: Python,
    22     py: Python,
    23     repo_path: PyObject,
    23     repo_path: PyObject,
    24     to: BaseRevision,
    24     to: BaseRevision,
       
    25     num_cpus: Option<usize>,
    25 ) -> PyResult<usize> {
    26 ) -> PyResult<usize> {
    26     log::trace!("Using update from null fastpath");
    27     log::trace!("Using update from null fastpath");
    27     let repo = repo_from_path(py, repo_path)?;
    28     let repo = repo_from_path(py, repo_path)?;
    28     let progress: &dyn Progress = &HgProgressBar::new("updating");
    29     let progress: &dyn Progress = &HgProgressBar::new("updating");
    29     hgerror_to_pyerr(py, update_from_null(&repo, to.into(), progress))
    30     hgerror_to_pyerr(
       
    31         py,
       
    32         update_from_null(&repo, to.into(), progress, num_cpus),
       
    33     )
    30 }
    34 }
    31 
    35 
    32 pub fn init_module(py: Python, package: &str) -> PyResult<PyModule> {
    36 pub fn init_module(py: Python, package: &str) -> PyResult<PyModule> {
    33     let dotted_name = &format!("{}.update", package);
    37     let dotted_name = &format!("{}.update", package);
    34     let m = PyModule::new(py, dotted_name)?;
    38     let m = PyModule::new(py, dotted_name)?;
    39     m.add(
    43     m.add(
    40         py,
    44         py,
    41         "update_from_null",
    45         "update_from_null",
    42         py_fn!(
    46         py_fn!(
    43             py,
    47             py,
    44             update_from_null_fast_path(repo_path: PyObject, to: BaseRevision,)
    48             update_from_null_fast_path(
       
    49                 repo_path: PyObject,
       
    50                 to: BaseRevision,
       
    51                 num_cpus: Option<usize>
       
    52             )
    45         ),
    53         ),
    46     )?;
    54     )?;
    47 
    55 
    48     let sys = PyModule::import(py, "sys")?;
    56     let sys = PyModule::import(py, "sys")?;
    49     let sys_modules: PyDict = sys.get(py, "modules")?.extract(py)?;
    57     let sys_modules: PyDict = sys.get(py, "modules")?.extract(py)?;