changeset 49138:c6c1caf28349

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
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 12 Apr 2022 17:29:21 +0200
parents 66e22a4d856b
children 7241b3721ba5
files rust/hg-core/src/dirstate/entry.rs
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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