rust/hg-core/src/copy_tracing.rs
changeset 46153 0a721fc457bf
parent 46152 e166e8a035a7
child 46154 ecbb2fc9418c
equal deleted inserted replaced
46152:e166e8a035a7 46153:0a721fc457bf
     2 use crate::utils::hg_path::HgPathBuf;
     2 use crate::utils::hg_path::HgPathBuf;
     3 use crate::Revision;
     3 use crate::Revision;
     4 use crate::NULL_REVISION;
     4 use crate::NULL_REVISION;
     5 
     5 
     6 use im_rc::ordmap::DiffItem;
     6 use im_rc::ordmap::DiffItem;
       
     7 use im_rc::ordmap::Entry;
     7 use im_rc::ordmap::OrdMap;
     8 use im_rc::ordmap::OrdMap;
     8 
     9 
     9 use std::cmp::Ordering;
    10 use std::cmp::Ordering;
    10 use std::collections::HashMap;
    11 use std::collections::HashMap;
    11 use std::convert::TryInto;
    12 use std::convert::TryInto;
   508                 }
   509                 }
   509                 // Each new entry is introduced by the children, we
   510                 // Each new entry is introduced by the children, we
   510                 // record this information as we will need it to take
   511                 // record this information as we will need it to take
   511                 // the right decision when merging conflicting copy
   512                 // the right decision when merging conflicting copy
   512                 // information. See merge_copies_dict for details.
   513                 // information. See merge_copies_dict for details.
   513                 let ttpc = TimeStampedPathCopy {
   514                 match copies.entry(dest) {
   514                     rev: current_rev,
   515                     Entry::Vacant(slot) => {
   515                     path: entry,
   516                         let ttpc = TimeStampedPathCopy {
   516                 };
   517                             rev: current_rev,
   517                 copies.insert(dest.to_owned(), ttpc);
   518                             path: entry,
       
   519                         };
       
   520                         slot.insert(ttpc);
       
   521                     }
       
   522                     Entry::Occupied(mut slot) => {
       
   523                         let mut ttpc = slot.get_mut();
       
   524                         ttpc.rev = current_rev;
       
   525                         ttpc.path = entry;
       
   526                     }
       
   527                 }
   518             }
   528             }
   519             Action::Removed(deleted_path) => {
   529             Action::Removed(deleted_path) => {
   520                 // We must drop copy information for removed file.
   530                 // We must drop copy information for removed file.
   521                 //
   531                 //
   522                 // We need to explicitly record them as dropped to
   532                 // We need to explicitly record them as dropped to