rust/hg-core/src/dirstate/status.rs
changeset 43649 8210c3f46912
parent 43648 51cd86735608
child 43836 ce088b38f92b
equal deleted inserted replaced
43648:51cd86735608 43649:8210c3f46912
     7 
     7 
     8 //! Rust implementation of dirstate.status (dirstate.py).
     8 //! Rust implementation of dirstate.status (dirstate.py).
     9 //! It is currently missing a lot of functionality compared to the Python one
     9 //! It is currently missing a lot of functionality compared to the Python one
    10 //! and will only be triggered in narrow cases.
    10 //! and will only be triggered in narrow cases.
    11 
    11 
    12 use crate::utils::files::HgMetadata;
    12 use crate::{
    13 use crate::utils::hg_path::{hg_path_to_path_buf, HgPath};
    13     dirstate::SIZE_FROM_OTHER_PARENT,
    14 use crate::{CopyMap, DirstateEntry, DirstateMap, EntryState};
    14     utils::{
       
    15         files::HgMetadata,
       
    16         hg_path::{hg_path_to_path_buf, HgPath},
       
    17     },
       
    18     CopyMap, DirstateEntry, DirstateMap, EntryState,
       
    19 };
    15 use rayon::prelude::*;
    20 use rayon::prelude::*;
    16 use std::path::Path;
    21 use std::path::Path;
    17 
    22 
    18 /// Marker enum used to dispatch new status entries into the right collections.
    23 /// Marker enum used to dispatch new status entries into the right collections.
    19 /// Is similar to `crate::EntryState`, but represents the transient state of
    24 /// Is similar to `crate::EntryState`, but represents the transient state of
    67         EntryState::Normal => {
    72         EntryState::Normal => {
    68             let size_changed = mod_compare(size, st_size as i32);
    73             let size_changed = mod_compare(size, st_size as i32);
    69             let mode_changed =
    74             let mode_changed =
    70                 (mode ^ st_mode as i32) & 0o100 != 0o000 && check_exec;
    75                 (mode ^ st_mode as i32) & 0o100 != 0o000 && check_exec;
    71             let metadata_changed = size >= 0 && (size_changed || mode_changed);
    76             let metadata_changed = size >= 0 && (size_changed || mode_changed);
    72             let other_parent = size == -2;
    77             let other_parent = size == SIZE_FROM_OTHER_PARENT;
    73             if metadata_changed
    78             if metadata_changed
    74                 || other_parent
    79                 || other_parent
    75                 || copy_map.contains_key(filename.as_ref())
    80                 || copy_map.contains_key(filename.as_ref())
    76             {
    81             {
    77                 Dispatch::Modified
    82                 Dispatch::Modified