##// END OF EJS Templates
dirstate-v2: preserve the fallback values on disk...
marmoute -
r49070:b874e8d8 default
parent child Browse files
Show More
@@ -386,6 +386,10 b' Node components are:'
386 386 EXPECTED_STATE_IS_MODIFIED = 1 << 8
387 387 ALL_UNKNOWN_RECORDED = 1 << 9
388 388 ALL_IGNORED_RECORDED = 1 << 10
389 HAS_FALLBACK_EXEC = 1 << 11
390 FALLBACK_EXEC = 1 << 12
391 HAS_FALLBACK_SYMLINK = 1 << 13
392 FALLBACK_SYMLINK = 1 << 14
389 393
390 394 The meaning of each bit is described below.
391 395
@@ -558,3 +562,33 b' by enabling it to skip `readdir` in more'
558 562 Also note that having this flag unset does not imply that no "ignored"
559 563 children have been recorded. Some might be present, but there is no garantee
560 564 that is will be all of them.
565
566 `HAS_FALLBACK_EXEC`
567 If this flag is set, the entry carries "fallback" information for the
568 executable bit in the `FALLBACK_EXEC` flag.
569
570 Fallback information can be stored in the dirstate to keep track of
571 filesystem attribute tracked by Mercurial when the underlying file
572 system or operating system does not support that property, (e.g.
573 Windows).
574
575 `FALLBACK_EXEC`
576 Should be ignored if `HAS_FALLBACK_EXEC` is unset. If set the file for this
577 entry should be considered executable if that information cannot be
578 extracted from the file system. If unset it should be considered
579 non-executable instead.
580
581 `HAS_FALLBACK_SYMLINK`
582 If this flag is set, the entry carries "fallback" information for symbolic
583 link status in the `FALLBACK_SYMLINK` flag.
584
585 Fallback information can be stored in the dirstate to keep track of
586 filesystem attribute tracked by Mercurial when the underlying file
587 system or operating system does not support that property, (e.g.
588 Windows).
589
590 `FALLBACK_SYMLINK`
591 Should be ignored if `HAS_FALLBACK_SYMLINK` is unset. If set the file for
592 this entry should be considered a symlink if that information cannot be
593 extracted from the file system. If unset it should be considered a normal
594 file instead.
@@ -56,6 +56,10 b' DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 7'
56 56 DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 8
57 57 DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 9
58 58 DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 10
59 DIRSTATE_V2_HAS_FALLBACK_EXEC = 1 << 11
60 DIRSTATE_V2_FALLBACK_EXEC = 1 << 12
61 DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 13
62 DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 14
59 63
60 64
61 65 @attr.s(slots=True, init=False)
@@ -142,6 +146,14 b' class DirstateItem(object):'
142 146 has_mode_size = False
143 147 has_meaningful_mtime = False
144 148
149 fallback_exec = None
150 if flags & DIRSTATE_V2_HAS_FALLBACK_EXEC:
151 fallback_exec = flags & DIRSTATE_V2_FALLBACK_EXEC
152
153 fallback_symlink = None
154 if flags & DIRSTATE_V2_HAS_FALLBACK_SYMLINK:
155 fallback_symlink = flags & DIRSTATE_V2_FALLBACK_SYMLINK
156
145 157 if has_mode_size:
146 158 assert stat.S_IXUSR == 0o100
147 159 if flags & DIRSTATE_V2_MODE_EXEC_PERM:
@@ -159,6 +171,8 b' class DirstateItem(object):'
159 171 has_meaningful_data=has_mode_size,
160 172 has_meaningful_mtime=has_meaningful_mtime,
161 173 parentfiledata=(mode, size, mtime),
174 fallback_exec=fallback_exec,
175 fallback_symlink=fallback_symlink,
162 176 )
163 177
164 178 @classmethod
@@ -428,6 +442,17 b' class DirstateItem(object):'
428 442 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
429 443 if self._mtime is not None:
430 444 flags |= DIRSTATE_V2_HAS_FILE_MTIME
445
446 if self._fallback_exec is not None:
447 flags |= DIRSTATE_V2_HAS_FALLBACK_EXEC
448 if self._fallback_exec:
449 flags |= DIRSTATE_V2_FALLBACK_EXEC
450
451 if self._fallback_symlink is not None:
452 flags |= DIRSTATE_V2_HAS_FALLBACK_SYMLINK
453 if self._fallback_symlink:
454 flags |= DIRSTATE_V2_FALLBACK_SYMLINK
455
431 456 # Note: we do not need to do anything regarding
432 457 # DIRSTATE_V2_ALL_UNKNOWN_RECORDED and DIRSTATE_V2_ALL_IGNORED_RECORDED
433 458 # since we never set _DIRSTATE_V2_HAS_DIRCTORY_MTIME
@@ -339,7 +339,15 b' impl DirstateEntry {'
339 339 /// Returns `(wdir_tracked, p1_tracked, p2_info, mode_size, mtime)`
340 340 pub(crate) fn v2_data(
341 341 &self,
342 ) -> (bool, bool, bool, Option<(u32, u32)>, Option<u32>) {
342 ) -> (
343 bool,
344 bool,
345 bool,
346 Option<(u32, u32)>,
347 Option<u32>,
348 Option<bool>,
349 Option<bool>,
350 ) {
343 351 if !self.any_tracked() {
344 352 // TODO: return an Option instead?
345 353 panic!("Accessing v1_state of an untracked DirstateEntry")
@@ -349,7 +357,15 b' impl DirstateEntry {'
349 357 let p2_info = self.flags.contains(Flags::P2_INFO);
350 358 let mode_size = self.mode_size;
351 359 let mtime = self.mtime;
352 (wdir_tracked, p1_tracked, p2_info, mode_size, mtime)
360 (
361 wdir_tracked,
362 p1_tracked,
363 p2_info,
364 mode_size,
365 mtime,
366 self.get_fallback_exec(),
367 self.get_fallback_symlink(),
368 )
353 369 }
354 370
355 371 fn v1_state(&self) -> EntryState {
@@ -113,6 +113,10 b' bitflags! {'
113 113 const EXPECTED_STATE_IS_MODIFIED = 1 << 8;
114 114 const ALL_UNKNOWN_RECORDED = 1 << 9;
115 115 const ALL_IGNORED_RECORDED = 1 << 10;
116 const HAS_FALLBACK_EXEC = 1 << 11;
117 const FALLBACK_EXEC = 1 << 12;
118 const HAS_FALLBACK_SYMLINK = 1 << 13;
119 const FALLBACK_SYMLINK = 1 << 14;
116 120 }
117 121 }
118 122
@@ -420,8 +424,15 b' impl Node {'
420 424 fn from_dirstate_entry(
421 425 entry: &DirstateEntry,
422 426 ) -> (Flags, U32Be, PackedTruncatedTimestamp) {
423 let (wdir_tracked, p1_tracked, p2_info, mode_size_opt, mtime_opt) =
424 entry.v2_data();
427 let (
428 wdir_tracked,
429 p1_tracked,
430 p2_info,
431 mode_size_opt,
432 mtime_opt,
433 fallback_exec,
434 fallback_symlink,
435 ) = entry.v2_data();
425 436 // TODO: convert throug raw flag bits instead?
426 437 let mut flags = Flags::empty();
427 438 flags.set(Flags::WDIR_TRACKED, wdir_tracked);
@@ -446,6 +457,18 b' impl Node {'
446 457 } else {
447 458 PackedTruncatedTimestamp::null()
448 459 };
460 if let Some(f_exec) = fallback_exec {
461 flags.insert(Flags::HAS_FALLBACK_EXEC);
462 if f_exec {
463 flags.insert(Flags::FALLBACK_EXEC);
464 }
465 }
466 if let Some(f_symlink) = fallback_symlink {
467 flags.insert(Flags::HAS_FALLBACK_SYMLINK);
468 if f_symlink {
469 flags.insert(Flags::FALLBACK_SYMLINK);
470 }
471 }
449 472 (flags, size, mtime)
450 473 }
451 474 }
General Comments 0
You need to be logged in to leave comments. Login now