rust/hg-cpython/src/dirstate/dirstate_map.rs
changeset 47109 33e5511b571a
parent 47101 5d62243c7732
child 47112 d5956136d19d
equal deleted inserted replaced
47108:e3cebe96c0fc 47109:33e5511b571a
    28 use hg::{
    28 use hg::{
    29     dirstate::parsers::Timestamp,
    29     dirstate::parsers::Timestamp,
    30     dirstate_tree::dispatch::DirstateMapMethods,
    30     dirstate_tree::dispatch::DirstateMapMethods,
    31     errors::HgError,
    31     errors::HgError,
    32     revlog::Node,
    32     revlog::Node,
       
    33     utils::files::normalize_case,
    33     utils::hg_path::{HgPath, HgPathBuf},
    34     utils::hg_path::{HgPath, HgPathBuf},
    34     DirsMultiset, DirstateEntry, DirstateMap as RustDirstateMap,
    35     DirsMultiset, DirstateEntry, DirstateMap as RustDirstateMap,
    35     DirstateMapError, DirstateParents, EntryState, StateMapIter,
    36     DirstateMapError, DirstateParents, EntryState, StateMapIter,
    36 };
    37 };
    37 
    38 
   327         }
   328         }
   328     }
   329     }
   329 
   330 
   330     def filefoldmapasdict(&self) -> PyResult<PyDict> {
   331     def filefoldmapasdict(&self) -> PyResult<PyDict> {
   331         let dict = PyDict::new(py);
   332         let dict = PyDict::new(py);
   332         for (key, value) in
   333         for (path, entry) in self.inner(py).borrow_mut().iter() {
   333             self.inner(py).borrow_mut().build_file_fold_map().iter()
   334             if entry.state != EntryState::Removed {
   334         {
   335                 let key = normalize_case(path);
   335             dict.set_item(
   336                 let value = path;
   336                 py,
   337                 dict.set_item(
   337                 PyBytes::new(py, key.as_bytes()).into_object(),
   338                     py,
   338                 PyBytes::new(py, value.as_bytes()).into_object(),
   339                     PyBytes::new(py, key.as_bytes()).into_object(),
   339             )?;
   340                     PyBytes::new(py, value.as_bytes()).into_object(),
       
   341                 )?;
       
   342             }
   340         }
   343         }
   341         Ok(dict)
   344         Ok(dict)
   342     }
   345     }
   343 
   346 
   344     def __len__(&self) -> PyResult<usize> {
   347     def __len__(&self) -> PyResult<usize> {