comparison rust/hg-core/src/dirstate/entry.rs @ 48253:948570aa7630

dirstate: make DirstateItem constructor accept fallback value This could arguably goes in the previous changeset, but I wanted to keep that previous changeset small to focus more on the user code and the documentation. Differential Revision: https://phab.mercurial-scm.org/D11687
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 18 Oct 2021 20:02:05 +0200
parents 602c8e8411f5
children b874e8d81a98
comparison
equal deleted inserted replaced
48252:602c8e8411f5 48253:948570aa7630
181 wdir_tracked: bool, 181 wdir_tracked: bool,
182 p1_tracked: bool, 182 p1_tracked: bool,
183 p2_info: bool, 183 p2_info: bool,
184 mode_size: Option<(u32, u32)>, 184 mode_size: Option<(u32, u32)>,
185 mtime: Option<u32>, 185 mtime: Option<u32>,
186 fallback_exec: Option<bool>,
187 fallback_symlink: Option<bool>,
186 ) -> Self { 188 ) -> Self {
187 if let Some((mode, size)) = mode_size { 189 if let Some((mode, size)) = mode_size {
188 // TODO: return an error for out of range values? 190 // TODO: return an error for out of range values?
189 assert!(mode & !RANGE_MASK_31BIT == 0); 191 assert!(mode & !RANGE_MASK_31BIT == 0);
190 assert!(size & !RANGE_MASK_31BIT == 0); 192 assert!(size & !RANGE_MASK_31BIT == 0);
194 } 196 }
195 let mut flags = Flags::empty(); 197 let mut flags = Flags::empty();
196 flags.set(Flags::WDIR_TRACKED, wdir_tracked); 198 flags.set(Flags::WDIR_TRACKED, wdir_tracked);
197 flags.set(Flags::P1_TRACKED, p1_tracked); 199 flags.set(Flags::P1_TRACKED, p1_tracked);
198 flags.set(Flags::P2_INFO, p2_info); 200 flags.set(Flags::P2_INFO, p2_info);
201 if let Some(exec) = fallback_exec {
202 flags.insert(Flags::HAS_FALLBACK_EXEC);
203 if exec {
204 flags.insert(Flags::FALLBACK_EXEC);
205 }
206 }
207 if let Some(exec) = fallback_symlink {
208 flags.insert(Flags::HAS_FALLBACK_SYMLINK);
209 if exec {
210 flags.insert(Flags::FALLBACK_SYMLINK);
211 }
212 }
199 Self { 213 Self {
200 flags, 214 flags,
201 mode_size, 215 mode_size,
202 mtime, 216 mtime,
203 } 217 }