rust/hg-core/src/dirstate_tree/dirstate_map.rs
changeset 47119 15395fd8ab28
parent 47118 c92e63762573
child 47120 7109a38830c9
equal deleted inserted replaced
47118:c92e63762573 47119:15395fd8ab28
     1 use bytes_cast::BytesCast;
     1 use bytes_cast::BytesCast;
     2 use micro_timer::timed;
     2 use micro_timer::timed;
       
     3 use std::convert::TryInto;
     3 use std::path::PathBuf;
     4 use std::path::PathBuf;
     4 use std::{collections::BTreeMap, convert::TryInto};
       
     5 
     5 
     6 use super::path_with_basename::WithBasename;
     6 use super::path_with_basename::WithBasename;
     7 use crate::dirstate::parsers::clear_ambiguous_mtime;
     7 use crate::dirstate::parsers::clear_ambiguous_mtime;
     8 use crate::dirstate::parsers::pack_entry;
     8 use crate::dirstate::parsers::pack_entry;
     9 use crate::dirstate::parsers::packed_entry_size;
     9 use crate::dirstate::parsers::packed_entry_size;
    18 use crate::DirstateError;
    18 use crate::DirstateError;
    19 use crate::DirstateMapError;
    19 use crate::DirstateMapError;
    20 use crate::DirstateParents;
    20 use crate::DirstateParents;
    21 use crate::DirstateStatus;
    21 use crate::DirstateStatus;
    22 use crate::EntryState;
    22 use crate::EntryState;
       
    23 use crate::FastHashMap;
    23 use crate::PatternFileWarning;
    24 use crate::PatternFileWarning;
    24 use crate::StateMapIter;
    25 use crate::StateMapIter;
    25 use crate::StatusError;
    26 use crate::StatusError;
    26 use crate::StatusOptions;
    27 use crate::StatusOptions;
    27 
    28 
    41 /// Using a plain `HgPathBuf` of the full path from the repository root as a
    42 /// Using a plain `HgPathBuf` of the full path from the repository root as a
    42 /// map key would also work: all paths in a given map have the same parent
    43 /// map key would also work: all paths in a given map have the same parent
    43 /// path, so comparing full paths gives the same result as comparing base
    44 /// path, so comparing full paths gives the same result as comparing base
    44 /// names. However `BTreeMap` would waste time always re-comparing the same
    45 /// names. However `BTreeMap` would waste time always re-comparing the same
    45 /// string prefix.
    46 /// string prefix.
    46 pub(super) type ChildNodes = BTreeMap<WithBasename<HgPathBuf>, Node>;
    47 pub(super) type ChildNodes = FastHashMap<WithBasename<HgPathBuf>, Node>;
    47 
    48 
    48 /// Represents a file or a directory
    49 /// Represents a file or a directory
    49 #[derive(Default)]
    50 #[derive(Default)]
    50 pub(super) struct Node {
    51 pub(super) struct Node {
    51     /// `None` for directories
    52     /// `None` for directories
    84 impl DirstateMap {
    85 impl DirstateMap {
    85     pub fn new() -> Self {
    86     pub fn new() -> Self {
    86         Self {
    87         Self {
    87             parents: None,
    88             parents: None,
    88             dirty_parents: false,
    89             dirty_parents: false,
    89             root: ChildNodes::new(),
    90             root: ChildNodes::default(),
    90             nodes_with_entry_count: 0,
    91             nodes_with_entry_count: 0,
    91             nodes_with_copy_source_count: 0,
    92             nodes_with_copy_source_count: 0,
    92         }
    93         }
    93     }
    94     }
    94 
    95