comparison rust/hg-core/src/dirstate/dirstate_map.rs @ 47524:69a463a4f193

dirstate: no longer pass the `oldstate` value to the dirstatemap The dirstatemap already have this information. Differential Revision: https://phab.mercurial-scm.org/D10966
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 03 Jul 2021 20:59:26 +0200
parents abed645b8e96
children fe4641cf9b72
comparison
equal deleted inserted replaced
47523:b76d54b90dc9 47524:69a463a4f193
66 66
67 /// Add a tracked file to the dirstate 67 /// Add a tracked file to the dirstate
68 pub fn add_file( 68 pub fn add_file(
69 &mut self, 69 &mut self,
70 filename: &HgPath, 70 filename: &HgPath,
71 old_state: EntryState,
72 entry: DirstateEntry, 71 entry: DirstateEntry,
73 // XXX once the dust settle this should probably become an enum 72 // XXX once the dust settle this should probably become an enum
74 from_p2: bool, 73 from_p2: bool,
75 possibly_dirty: bool, 74 possibly_dirty: bool,
76 ) -> Result<(), DirstateError> { 75 ) -> Result<(), DirstateError> {
89 entry.mtime = MTIME_UNSET; 88 entry.mtime = MTIME_UNSET;
90 } else { 89 } else {
91 entry.size = entry.size & V1_RANGEMASK; 90 entry.size = entry.size & V1_RANGEMASK;
92 entry.mtime = entry.mtime & V1_RANGEMASK; 91 entry.mtime = entry.mtime & V1_RANGEMASK;
93 } 92 }
94 93 let old_state = match self.get(filename) {
94 Some(e) => e.state,
95 None => EntryState::Unknown,
96 };
95 if old_state == EntryState::Unknown || old_state == EntryState::Removed 97 if old_state == EntryState::Unknown || old_state == EntryState::Removed
96 { 98 {
97 if let Some(ref mut dirs) = self.dirs { 99 if let Some(ref mut dirs) = self.dirs {
98 dirs.add_path(filename)?; 100 dirs.add_path(filename)?;
99 } 101 }
395 397
396 assert_eq!(0, map.len()); 398 assert_eq!(0, map.len());
397 399
398 map.add_file( 400 map.add_file(
399 HgPath::new(b"meh"), 401 HgPath::new(b"meh"),
400 EntryState::Normal,
401 DirstateEntry { 402 DirstateEntry {
402 state: EntryState::Normal, 403 state: EntryState::Normal,
403 mode: 1337, 404 mode: 1337,
404 mtime: 1337, 405 mtime: 1337,
405 size: 1337, 406 size: 1337,