rust-dirstate-entry: add `modified` method
authorRaphaël Gomès <rgomes@octobus.net>
Tue, 12 Apr 2022 17:29:21 +0200
changeset 49193 c6c1caf28349
parent 49192 66e22a4d856b
child 49194 7241b3721ba5
rust-dirstate-entry: add `modified` method This will also be used in other places later in the series. Differential Revision: https://phab.mercurial-scm.org/D12536
rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs	Tue Apr 12 17:27:56 2022 +0200
+++ b/rust/hg-core/src/dirstate/entry.rs	Tue Apr 12 17:29:21 2022 +0200
@@ -417,6 +417,11 @@
         self.flags.contains(Flags::WDIR_TRACKED) && !self.in_either_parent()
     }
 
+    pub fn modified(&self) -> bool {
+        self.flags
+            .contains(Flags::WDIR_TRACKED | Flags::P1_TRACKED | Flags::P2_INFO)
+    }
+
     pub fn maybe_clean(&self) -> bool {
         if !self.flags.contains(Flags::WDIR_TRACKED) {
             false
@@ -463,10 +468,7 @@
         }
         if self.removed() {
             EntryState::Removed
-        } else if self
-            .flags
-            .contains(Flags::WDIR_TRACKED | Flags::P1_TRACKED | Flags::P2_INFO)
-        {
+        } else if self.modified() {
             EntryState::Merged
         } else if self.added() {
             EntryState::Added