rust/hg-core/src/dirstate_tree/on_disk.rs
changeset 47478 ca8121d26732
parent 47476 f23eafb036af
child 47491 8851acad5906
equal deleted inserted replaced
47477:eb416759af7e 47478:ca8121d26732
    74     /// In bytes from `self.full_path.start`
    74     /// In bytes from `self.full_path.start`
    75     base_name_start: Size,
    75     base_name_start: Size,
    76 
    76 
    77     copy_source: OptPathSlice,
    77     copy_source: OptPathSlice,
    78     children: ChildNodes,
    78     children: ChildNodes,
       
    79     pub(super) descendants_with_entry_count: Size,
    79     pub(super) tracked_descendants_count: Size,
    80     pub(super) tracked_descendants_count: Size,
    80 
    81 
    81     /// Dependending on the value of `state`:
    82     /// Dependending on the value of `state`:
    82     ///
    83     ///
    83     /// * A null byte: `data` is not used.
    84     /// * A null byte: `data` is not used.
   170 type OptPathSlice = Slice;
   171 type OptPathSlice = Slice;
   171 
   172 
   172 /// Make sure that size-affecting changes are made knowingly
   173 /// Make sure that size-affecting changes are made knowingly
   173 fn _static_assert_size_of() {
   174 fn _static_assert_size_of() {
   174     let _ = std::mem::transmute::<Header, [u8; 88]>;
   175     let _ = std::mem::transmute::<Header, [u8; 88]>;
   175     let _ = std::mem::transmute::<Node, [u8; 45]>;
   176     let _ = std::mem::transmute::<Node, [u8; 49]>;
   176 }
   177 }
   177 
   178 
   178 /// Unexpected file format found in `.hg/dirstate` with the "v2" format.
   179 /// Unexpected file format found in `.hg/dirstate` with the "v2" format.
   179 ///
   180 ///
   180 /// This should only happen if Mercurial is buggy or a repository is corrupted.
   181 /// This should only happen if Mercurial is buggy or a repository is corrupted.
   358             children: dirstate_map::ChildNodes::OnDisk(
   359             children: dirstate_map::ChildNodes::OnDisk(
   359                 self.children(on_disk)?,
   360                 self.children(on_disk)?,
   360             ),
   361             ),
   361             copy_source: self.copy_source(on_disk)?.map(Cow::Borrowed),
   362             copy_source: self.copy_source(on_disk)?.map(Cow::Borrowed),
   362             data: self.node_data()?,
   363             data: self.node_data()?,
       
   364             descendants_with_entry_count: self
       
   365                 .descendants_with_entry_count
       
   366                 .get(),
   363             tracked_descendants_count: self.tracked_descendants_count.get(),
   367             tracked_descendants_count: self.tracked_descendants_count.get(),
   364         })
   368         })
   365     }
   369     }
   366 }
   370 }
   367 
   371 
   563                     full_path,
   567                     full_path,
   564                     base_name_start: u32::try_from(path.base_name_start())
   568                     base_name_start: u32::try_from(path.base_name_start())
   565                         // Could only panic for paths over 4 GiB
   569                         // Could only panic for paths over 4 GiB
   566                         .expect("dirstate-v2 offset overflow")
   570                         .expect("dirstate-v2 offset overflow")
   567                         .into(),
   571                         .into(),
       
   572                     descendants_with_entry_count: node
       
   573                         .descendants_with_entry_count
       
   574                         .into(),
   568                     tracked_descendants_count: node
   575                     tracked_descendants_count: node
   569                         .tracked_descendants_count
   576                         .tracked_descendants_count
   570                         .into(),
   577                         .into(),
   571                     state,
   578                     state,
   572                     data,
   579                     data,