##// 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 EXPECTED_STATE_IS_MODIFIED = 1 << 8
386 EXPECTED_STATE_IS_MODIFIED = 1 << 8
387 ALL_UNKNOWN_RECORDED = 1 << 9
387 ALL_UNKNOWN_RECORDED = 1 << 9
388 ALL_IGNORED_RECORDED = 1 << 10
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 The meaning of each bit is described below.
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 Also note that having this flag unset does not imply that no "ignored"
562 Also note that having this flag unset does not imply that no "ignored"
559 children have been recorded. Some might be present, but there is no garantee
563 children have been recorded. Some might be present, but there is no garantee
560 that is will be all of them.
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 DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 8
56 DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 8
57 DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 9
57 DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 9
58 DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 10
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 @attr.s(slots=True, init=False)
65 @attr.s(slots=True, init=False)
@@ -142,6 +146,14 b' class DirstateItem(object):'
142 has_mode_size = False
146 has_mode_size = False
143 has_meaningful_mtime = False
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 if has_mode_size:
157 if has_mode_size:
146 assert stat.S_IXUSR == 0o100
158 assert stat.S_IXUSR == 0o100
147 if flags & DIRSTATE_V2_MODE_EXEC_PERM:
159 if flags & DIRSTATE_V2_MODE_EXEC_PERM:
@@ -159,6 +171,8 b' class DirstateItem(object):'
159 has_meaningful_data=has_mode_size,
171 has_meaningful_data=has_mode_size,
160 has_meaningful_mtime=has_meaningful_mtime,
172 has_meaningful_mtime=has_meaningful_mtime,
161 parentfiledata=(mode, size, mtime),
173 parentfiledata=(mode, size, mtime),
174 fallback_exec=fallback_exec,
175 fallback_symlink=fallback_symlink,
162 )
176 )
163
177
164 @classmethod
178 @classmethod
@@ -428,6 +442,17 b' class DirstateItem(object):'
428 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
442 flags |= DIRSTATE_V2_MODE_IS_SYMLINK
429 if self._mtime is not None:
443 if self._mtime is not None:
430 flags |= DIRSTATE_V2_HAS_FILE_MTIME
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 # Note: we do not need to do anything regarding
456 # Note: we do not need to do anything regarding
432 # DIRSTATE_V2_ALL_UNKNOWN_RECORDED and DIRSTATE_V2_ALL_IGNORED_RECORDED
457 # DIRSTATE_V2_ALL_UNKNOWN_RECORDED and DIRSTATE_V2_ALL_IGNORED_RECORDED
433 # since we never set _DIRSTATE_V2_HAS_DIRCTORY_MTIME
458 # since we never set _DIRSTATE_V2_HAS_DIRCTORY_MTIME
@@ -339,7 +339,15 b' impl DirstateEntry {'
339 /// Returns `(wdir_tracked, p1_tracked, p2_info, mode_size, mtime)`
339 /// Returns `(wdir_tracked, p1_tracked, p2_info, mode_size, mtime)`
340 pub(crate) fn v2_data(
340 pub(crate) fn v2_data(
341 &self,
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 if !self.any_tracked() {
351 if !self.any_tracked() {
344 // TODO: return an Option instead?
352 // TODO: return an Option instead?
345 panic!("Accessing v1_state of an untracked DirstateEntry")
353 panic!("Accessing v1_state of an untracked DirstateEntry")
@@ -349,7 +357,15 b' impl DirstateEntry {'
349 let p2_info = self.flags.contains(Flags::P2_INFO);
357 let p2_info = self.flags.contains(Flags::P2_INFO);
350 let mode_size = self.mode_size;
358 let mode_size = self.mode_size;
351 let mtime = self.mtime;
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 fn v1_state(&self) -> EntryState {
371 fn v1_state(&self) -> EntryState {
@@ -113,6 +113,10 b' bitflags! {'
113 const EXPECTED_STATE_IS_MODIFIED = 1 << 8;
113 const EXPECTED_STATE_IS_MODIFIED = 1 << 8;
114 const ALL_UNKNOWN_RECORDED = 1 << 9;
114 const ALL_UNKNOWN_RECORDED = 1 << 9;
115 const ALL_IGNORED_RECORDED = 1 << 10;
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 fn from_dirstate_entry(
424 fn from_dirstate_entry(
421 entry: &DirstateEntry,
425 entry: &DirstateEntry,
422 ) -> (Flags, U32Be, PackedTruncatedTimestamp) {
426 ) -> (Flags, U32Be, PackedTruncatedTimestamp) {
423 let (wdir_tracked, p1_tracked, p2_info, mode_size_opt, mtime_opt) =
427 let (
424 entry.v2_data();
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 // TODO: convert throug raw flag bits instead?
436 // TODO: convert throug raw flag bits instead?
426 let mut flags = Flags::empty();
437 let mut flags = Flags::empty();
427 flags.set(Flags::WDIR_TRACKED, wdir_tracked);
438 flags.set(Flags::WDIR_TRACKED, wdir_tracked);
@@ -446,6 +457,18 b' impl Node {'
446 } else {
457 } else {
447 PackedTruncatedTimestamp::null()
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 (flags, size, mtime)
472 (flags, size, mtime)
450 }
473 }
451 }
474 }
General Comments 0
You need to be logged in to leave comments. Login now