comparison rust/hg-cpython/src/dirstate/dirstate_map.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 1a535313ad1b
children 01d3ce3281cf
comparison
equal deleted inserted replaced
42801:1a535313ad1b 42802:2e1f74cc3350
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::PySharedState, 24 ref_sharing::PySharedState,
25 }; 25 };
26 use hg::{ 26 use hg::{
27 DirsIterable, DirsMultiset, DirstateEntry, DirstateMap as RustDirstateMap, 27 DirsMultiset, DirstateEntry, DirstateMap as RustDirstateMap,
28 DirstateParents, DirstateParseError, EntryState, PARENT_SIZE, 28 DirstateParents, DirstateParseError, EntryState, PARENT_SIZE,
29 }; 29 };
30 30
31 // TODO 31 // TODO
32 // This object needs to share references to multiple members of its Rust 32 // This object needs to share references to multiple members of its Rust
354 def getdirs(&self) -> PyResult<Dirs> { 354 def getdirs(&self) -> PyResult<Dirs> {
355 // TODO don't copy, share the reference 355 // TODO don't copy, share the reference
356 self.inner(py).borrow_mut().set_dirs(); 356 self.inner(py).borrow_mut().set_dirs();
357 Dirs::from_inner( 357 Dirs::from_inner(
358 py, 358 py,
359 DirsMultiset::new( 359 DirsMultiset::from_dirstate(
360 DirsIterable::Dirstate(&self.inner(py).borrow()), 360 &self.inner(py).borrow(),
361 Some(EntryState::Removed), 361 Some(EntryState::Removed),
362 ), 362 ),
363 ) 363 )
364 } 364 }
365 def getalldirs(&self) -> PyResult<Dirs> { 365 def getalldirs(&self) -> PyResult<Dirs> {
366 // TODO don't copy, share the reference 366 // TODO don't copy, share the reference
367 self.inner(py).borrow_mut().set_all_dirs(); 367 self.inner(py).borrow_mut().set_all_dirs();
368 Dirs::from_inner( 368 Dirs::from_inner(
369 py, 369 py,
370 DirsMultiset::new( 370 DirsMultiset::from_dirstate(
371 DirsIterable::Dirstate(&self.inner(py).borrow()), 371 &self.inner(py).borrow(),
372 None, 372 None,
373 ), 373 ),
374 ) 374 )
375 } 375 }
376 376