diff rust/hg-core/src/dirstate/entry.rs @ 48263:602c8e8411f5

dirstate: add a concept of "fallback" flags to dirstate item The concept is defined and "used" by the flag code, but it is neither persisted nor set anywhere yet. We currently focus on defining the semantic of the attribute. More to come in the next changesets Check the inline documentation for details. Differential Revision: https://phab.mercurial-scm.org/D11686
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 18 Oct 2021 20:02:15 +0200
parents 15dedc0c5c35
children 948570aa7630
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/entry.rs	Fri Oct 15 16:33:19 2021 +0200
+++ b/rust/hg-core/src/dirstate/entry.rs	Mon Oct 18 20:02:15 2021 +0200
@@ -29,6 +29,10 @@
         const WDIR_TRACKED = 1 << 0;
         const P1_TRACKED = 1 << 1;
         const P2_INFO = 1 << 2;
+        const HAS_FALLBACK_EXEC = 1 << 3;
+        const FALLBACK_EXEC = 1 << 4;
+        const HAS_FALLBACK_SYMLINK = 1 << 5;
+        const FALLBACK_SYMLINK = 1 << 6;
     }
 }
 
@@ -421,6 +425,52 @@
         self.v1_mtime()
     }
 
+    pub fn get_fallback_exec(&self) -> Option<bool> {
+        if self.flags.contains(Flags::HAS_FALLBACK_EXEC) {
+            Some(self.flags.contains(Flags::FALLBACK_EXEC))
+        } else {
+            None
+        }
+    }
+
+    pub fn set_fallback_exec(&mut self, value: Option<bool>) {
+        match value {
+            None => {
+                self.flags.remove(Flags::HAS_FALLBACK_EXEC);
+                self.flags.remove(Flags::FALLBACK_EXEC);
+            }
+            Some(exec) => {
+                self.flags.insert(Flags::HAS_FALLBACK_EXEC);
+                if exec {
+                    self.flags.insert(Flags::FALLBACK_EXEC);
+                }
+            }
+        }
+    }
+
+    pub fn get_fallback_symlink(&self) -> Option<bool> {
+        if self.flags.contains(Flags::HAS_FALLBACK_SYMLINK) {
+            Some(self.flags.contains(Flags::FALLBACK_SYMLINK))
+        } else {
+            None
+        }
+    }
+
+    pub fn set_fallback_symlink(&mut self, value: Option<bool>) {
+        match value {
+            None => {
+                self.flags.remove(Flags::HAS_FALLBACK_SYMLINK);
+                self.flags.remove(Flags::FALLBACK_SYMLINK);
+            }
+            Some(symlink) => {
+                self.flags.insert(Flags::HAS_FALLBACK_SYMLINK);
+                if symlink {
+                    self.flags.insert(Flags::FALLBACK_SYMLINK);
+                }
+            }
+        }
+    }
+
     pub fn drop_merge_data(&mut self) {
         if self.flags.contains(Flags::P2_INFO) {
             self.flags.remove(Flags::P2_INFO);