diff rust/hg-cpython/src/dirstate/dirs_multiset.rs @ 42802:2e1f74cc3350

rust-dirstate: split DirsMultiset constructor per input type Since skip_state only applies to dirstate, it doesn't make sense to unify these constructors and dispatch by enum.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 17 Aug 2019 18:25:29 +0900
parents 30320c7bf79f
children 8db8fa1de2ef
line wrap: on
line diff
--- a/rust/hg-cpython/src/dirstate/dirs_multiset.rs	Sat Aug 17 16:33:05 2019 +0900
+++ b/rust/hg-cpython/src/dirstate/dirs_multiset.rs	Sat Aug 17 18:25:29 2019 +0900
@@ -17,10 +17,7 @@
 };
 
 use crate::{dirstate::extract_dirstate, ref_sharing::PySharedState};
-use hg::{
-    DirsIterable, DirsMultiset, DirstateMapError, DirstateParseError,
-    EntryState,
-};
+use hg::{DirsMultiset, DirstateMapError, DirstateParseError, EntryState};
 
 py_class!(pub class Dirs |py| {
     data inner: RefCell<DirsMultiset>;
@@ -45,19 +42,13 @@
         }
         let inner = if let Ok(map) = map.cast_as::<PyDict>(py) {
             let dirstate = extract_dirstate(py, &map)?;
-            DirsMultiset::new(
-                DirsIterable::Dirstate(&dirstate),
-                skip_state,
-            )
+            DirsMultiset::from_dirstate(&dirstate, skip_state)
         } else {
             let map: Result<Vec<Vec<u8>>, PyErr> = map
                 .iter(py)?
                 .map(|o| Ok(o?.extract::<PyBytes>(py)?.data(py).to_owned()))
                 .collect();
-            DirsMultiset::new(
-                DirsIterable::Manifest(&map?),
-                skip_state,
-            )
+            DirsMultiset::from_manifest(&map?)
         };
 
         Self::create_instance(