rust/hg-core/src/dirstate/dirstate_map.rs
changeset 47105 ba17a2ee85ac
parent 47101 5d62243c7732
child 47108 e3cebe96c0fc
equal deleted inserted replaced
47104:fdf6cfa0e254 47105:ba17a2ee85ac
     3 // Copyright 2019 Raphaël Gomès <rgomes@octobus.net>
     3 // Copyright 2019 Raphaël Gomès <rgomes@octobus.net>
     4 //
     4 //
     5 // This software may be used and distributed according to the terms of the
     5 // This software may be used and distributed according to the terms of the
     6 // GNU General Public License version 2 or any later version.
     6 // GNU General Public License version 2 or any later version.
     7 
     7 
       
     8 use crate::dirstate::parsers::clear_ambiguous_mtime;
     8 use crate::dirstate::parsers::Timestamp;
     9 use crate::dirstate::parsers::Timestamp;
     9 use crate::errors::HgError;
    10 use crate::errors::HgError;
    10 use crate::revlog::node::NULL_NODE;
    11 use crate::revlog::node::NULL_NODE;
    11 use crate::{
    12 use crate::{
    12     dirstate::{parsers::PARENT_SIZE, EntryState, SIZE_FROM_OTHER_PARENT},
    13     dirstate::{parsers::PARENT_SIZE, EntryState, SIZE_FROM_OTHER_PARENT},
   186         &mut self,
   187         &mut self,
   187         filenames: Vec<HgPathBuf>,
   188         filenames: Vec<HgPathBuf>,
   188         now: i32,
   189         now: i32,
   189     ) {
   190     ) {
   190         for filename in filenames {
   191         for filename in filenames {
   191             let mut changed = false;
       
   192             if let Some(entry) = self.state_map.get_mut(&filename) {
   192             if let Some(entry) = self.state_map.get_mut(&filename) {
   193                 if entry.state == EntryState::Normal && entry.mtime == now {
   193                 if clear_ambiguous_mtime(entry, now) {
   194                     changed = true;
   194                     self.get_non_normal_other_parent_entries()
   195                     *entry = DirstateEntry {
   195                         .0
   196                         mtime: MTIME_UNSET,
   196                         .insert(filename.to_owned());
   197                         ..*entry
       
   198                     };
       
   199                 }
   197                 }
   200             }
       
   201             if changed {
       
   202                 self.get_non_normal_other_parent_entries()
       
   203                     .0
       
   204                     .insert(filename.to_owned());
       
   205             }
   198             }
   206         }
   199         }
   207     }
   200     }
   208 
   201 
   209     pub fn non_normal_entries_remove(
   202     pub fn non_normal_entries_remove(