Patchwork D12536: rust-dirstate-entry: add `modified` method

login
register
mail settings
Submitter phabricator
Date April 12, 2022, 4:05 p.m.
Message ID <differential-rev-PHID-DREV-5whc76hc5xfd4wz2ynij-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50883/
State New
Headers show

Comments

phabricator - April 12, 2022, 4:05 p.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This will also be used in other places later in the series.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12536

AFFECTED FILES
  rust/hg-core/src/dirstate/entry.rs

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/dirstate/entry.rs b/rust/hg-core/src/dirstate/entry.rs
--- a/rust/hg-core/src/dirstate/entry.rs
+++ b/rust/hg-core/src/dirstate/entry.rs
@@ -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