Patchwork D11704: dirstate-v2: reorder flag to group related one together

login
register
mail settings
Submitter phabricator
Date Oct. 19, 2021, 11:01 p.m.
Message ID <differential-rev-PHID-DREV-la3aixgu5qkuif6pktx7-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50028/
State Superseded
Headers show

Comments

phabricator - Oct. 19, 2021, 11:01 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Since the format is not frozen yet, it seems like the right moment to do it.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/util.h
  mercurial/helptext/internals/dirstate-v2.txt
  mercurial/pure/parsers.py
  rust/hg-core/src/dirstate_tree/on_disk.rs

CHANGE DETAILS




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

Patch

diff --git a/rust/hg-core/src/dirstate_tree/on_disk.rs b/rust/hg-core/src/dirstate_tree/on_disk.rs
--- a/rust/hg-core/src/dirstate_tree/on_disk.rs
+++ b/rust/hg-core/src/dirstate_tree/on_disk.rs
@@ -105,19 +105,19 @@ 
         const WDIR_TRACKED = 1 << 0;
         const P1_TRACKED = 1 << 1;
         const P2_INFO = 1 << 2;
-        const HAS_MODE_AND_SIZE = 1 << 3;
-        const HAS_MTIME = 1 << 4;
-        const DIRECTORY = 1 << 5;
-        const MODE_EXEC_PERM = 1 << 6;
-        const MODE_IS_SYMLINK = 1 << 7;
-        const EXPECTED_STATE_IS_MODIFIED = 1 << 8;
-        const ALL_UNKNOWN_RECORDED = 1 << 9;
-        const ALL_IGNORED_RECORDED = 1 << 10;
-        const HAS_FALLBACK_EXEC = 1 << 11;
-        const FALLBACK_EXEC = 1 << 12;
-        const HAS_FALLBACK_SYMLINK = 1 << 13;
-        const FALLBACK_SYMLINK = 1 << 14;
-        const MTIME_SECOND_AMBIGUOUS = 1 << 15;
+        const MODE_EXEC_PERM = 1 << 3;
+        const MODE_IS_SYMLINK = 1 << 4;
+        const HAS_FALLBACK_EXEC = 1 <<  5;
+        const FALLBACK_EXEC = 1 <<  6;
+        const HAS_FALLBACK_SYMLINK = 1 <<  7;
+        const FALLBACK_SYMLINK = 1 <<  8;
+        const EXPECTED_STATE_IS_MODIFIED = 1 << 9;
+        const HAS_MODE_AND_SIZE = 1 <<10;
+        const HAS_MTIME = 1 <<11;
+        const MTIME_SECOND_AMBIGUOUS = 1 << 12;
+        const DIRECTORY = 1 <<13;
+        const ALL_UNKNOWN_RECORDED = 1 <<14;
+        const ALL_IGNORED_RECORDED = 1 <<15;
     }
 }
 
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -48,19 +48,19 @@ 
 DIRSTATE_V2_WDIR_TRACKED = 1 << 0
 DIRSTATE_V2_P1_TRACKED = 1 << 1
 DIRSTATE_V2_P2_INFO = 1 << 2
-DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 3
-DIRSTATE_V2_HAS_MTIME = 1 << 4
-DIRSTATE_V2_DIRECTORY = 1 << 5
-DIRSTATE_V2_MODE_EXEC_PERM = 1 << 6
-DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 7
-DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 8
-DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 9
-DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 10
-DIRSTATE_V2_HAS_FALLBACK_EXEC = 1 << 11
-DIRSTATE_V2_FALLBACK_EXEC = 1 << 12
-DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 13
-DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 14
-DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS = 1 << 15
+DIRSTATE_V2_MODE_EXEC_PERM = 1 << 3
+DIRSTATE_V2_MODE_IS_SYMLINK = 1 << 4
+DIRSTATE_V2_HAS_FALLBACK_EXEC = 1 << 5
+DIRSTATE_V2_FALLBACK_EXEC = 1 << 6
+DIRSTATE_V2_HAS_FALLBACK_SYMLINK = 1 << 7
+DIRSTATE_V2_FALLBACK_SYMLINK = 1 << 8
+DIRSTATE_V2_EXPECTED_STATE_IS_MODIFIED = 1 << 9
+DIRSTATE_V2_HAS_MODE_AND_SIZE = 1 << 10
+DIRSTATE_V2_HAS_MTIME = 1 << 11
+DIRSTATE_V2_MTIME_SECOND_AMBIGUOUS = 1 << 12
+DIRSTATE_V2_DIRECTORY = 1 << 13
+DIRSTATE_V2_ALL_UNKNOWN_RECORDED = 1 << 14
+DIRSTATE_V2_ALL_IGNORED_RECORDED = 1 << 15
 
 
 @attr.s(slots=True, init=False)
diff --git a/mercurial/helptext/internals/dirstate-v2.txt b/mercurial/helptext/internals/dirstate-v2.txt
--- a/mercurial/helptext/internals/dirstate-v2.txt
+++ b/mercurial/helptext/internals/dirstate-v2.txt
@@ -378,19 +378,19 @@ 
     WDIR_TRACKED = 1 << 0
     P1_TRACKED = 1 << 1
     P2_INFO = 1 << 2
-    HAS_MODE_AND_SIZE = 1 << 3
-    HAS_MTIME = 1 << 4
-    DIRECTORY = 1 << 5
-    MODE_EXEC_PERM = 1 << 6
-    MODE_IS_SYMLINK = 1 << 7
-    EXPECTED_STATE_IS_MODIFIED = 1 << 8
-    ALL_UNKNOWN_RECORDED = 1 << 9
-    ALL_IGNORED_RECORDED = 1 << 10
-    HAS_FALLBACK_EXEC = 1 << 11
-    FALLBACK_EXEC = 1 << 12
-    HAS_FALLBACK_SYMLINK = 1 << 13
-    FALLBACK_SYMLINK = 1 << 14
-    MTIME_SECOND_AMBIGUOUS = 1 << 15
+    MODE_EXEC_PERM = 1 << 3
+    MODE_IS_SYMLINK = 1 << 4
+    HAS_FALLBACK_EXEC = 1 << 5
+    FALLBACK_EXEC = 1 << 6
+    HAS_FALLBACK_SYMLINK = 1 << 7
+    FALLBACK_SYMLINK = 1 << 8
+    EXPECTED_STATE_IS_MODIFIED = 1 << 9
+    HAS_MODE_AND_SIZE = 1 << 10
+    HAS_MTIME = 1 << 11
+    MTIME_SECOND_AMBIGUOUS = 1 << 12
+    DIRECTORY = 1 << 13
+    ALL_UNKNOWN_RECORDED = 1 << 14
+    ALL_IGNORED_RECORDED = 1 << 15
 
   The meaning of each bit is described below.
 
diff --git a/mercurial/cext/util.h b/mercurial/cext/util.h
--- a/mercurial/cext/util.h
+++ b/mercurial/cext/util.h
@@ -32,22 +32,22 @@ 
 } dirstateItemObject;
 /* clang-format on */
 
-static const int dirstate_flag_wc_tracked = 1;
+static const int dirstate_flag_wc_tracked = 1 << 0;
 static const int dirstate_flag_p1_tracked = 1 << 1;
 static const int dirstate_flag_p2_info = 1 << 2;
-static const int dirstate_flag_has_meaningful_data = 1 << 3;
-static const int dirstate_flag_has_mtime = 1 << 4;
-static const int dirstate_flag_directory = 1 << 5;
-static const int dirstate_flag_mode_exec_perm = 1 << 6;
-static const int dirstate_flag_mode_is_symlink = 1 << 7;
-static const int dirstate_flag_expected_state_is_modified = 1 << 8;
-static const int dirstate_flag_all_unknown_recorded = 1 << 9;
-static const int dirstate_flag_all_ignored_recorded = 1 << 10;
-static const int dirstate_flag_fallback_exec = 1 << 11;
-static const int dirstate_flag_has_fallback_exec = 1 << 12;
-static const int dirstate_flag_fallback_symlink = 1 << 13;
-static const int dirstate_flag_has_fallback_symlink = 1 << 14;
-static const int dirstate_flag_mtime_second_ambiguous = 1 << 15;
+static const int dirstate_flag_mode_exec_perm = 1 << 3;
+static const int dirstate_flag_mode_is_symlink = 1 << 4;
+static const int dirstate_flag_has_fallback_exec = 1 << 5;
+static const int dirstate_flag_fallback_exec = 1 << 6;
+static const int dirstate_flag_has_fallback_symlink = 1 << 7;
+static const int dirstate_flag_fallback_symlink = 1 << 8;
+static const int dirstate_flag_expected_state_is_modified = 1 << 9;
+static const int dirstate_flag_has_meaningful_data = 1 << 10;
+static const int dirstate_flag_has_mtime = 1 << 11;
+static const int dirstate_flag_mtime_second_ambiguous = 1 << 12;
+static const int dirstate_flag_directory = 1 << 13;
+static const int dirstate_flag_all_unknown_recorded = 1 << 14;
+static const int dirstate_flag_all_ignored_recorded = 1 << 15;
 
 extern PyTypeObject dirstateItemType;
 #define dirstate_tuple_check(op) (Py_TYPE(op) == &dirstateItemType)