marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This could arguably goes in the previous changeset, but I wanted to keep that
  previous changeset small to focus more on the user code and the documentation.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cext/parsers.c
  mercurial/pure/parsers.py
  rust/hg-core/src/dirstate/entry.rs
  rust/hg-core/src/dirstate_tree/on_disk.rs
  rust/hg-cpython/src/dirstate/item.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate/item.rs 
b/rust/hg-cpython/src/dirstate/item.rs
--- a/rust/hg-cpython/src/dirstate/item.rs
+++ b/rust/hg-cpython/src/dirstate/item.rs
@@ -23,6 +23,8 @@
         has_meaningful_data: bool = true,
         has_meaningful_mtime: bool = true,
         parentfiledata: Option<(u32, u32, u32)> = None,
+        fallback_exec: Option<bool> = None,
+        fallback_symlink: Option<bool> = None,
 
     ) -> PyResult<DirstateItem> {
         let mut mode_size_opt = None;
@@ -36,7 +38,13 @@
             }
         }
         let entry = DirstateEntry::from_v2_data(
-            wc_tracked, p1_tracked, p2_info, mode_size_opt, mtime_opt,
+            wc_tracked,
+            p1_tracked,
+            p2_info,
+            mode_size_opt,
+            mtime_opt,
+            fallback_exec,
+            fallback_symlink,
         );
         DirstateItem::create_instance(py, Cell::new(entry))
     }
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
@@ -378,6 +378,8 @@
             p2_info,
             mode_size,
             mtime,
+            None,
+            None,
         )
     }
 
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
@@ -181,6 +181,8 @@
         p2_info: bool,
         mode_size: Option<(u32, u32)>,
         mtime: Option<u32>,
+        fallback_exec: Option<bool>,
+        fallback_symlink: Option<bool>,
     ) -> Self {
         if let Some((mode, size)) = mode_size {
             // TODO: return an error for out of range values?
@@ -198,8 +200,8 @@
             flags,
             mode_size,
             mtime,
-            fallback_exec: None,
-            fallback_symlink: None,
+            fallback_exec: fallback_exec,
+            fallback_symlink: fallback_symlink,
         }
     }
 
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -107,13 +107,15 @@
         has_meaningful_data=True,
         has_meaningful_mtime=True,
         parentfiledata=None,
+        fallback_exec=None,
+        fallback_symlink=None,
     ):
         self._wc_tracked = wc_tracked
         self._p1_tracked = p1_tracked
         self._p2_info = p2_info
 
-        self._fallback_exec = None
-        self._fallback_symlink = None
+        self._fallback_exec = fallback_exec
+        self._fallback_symlink = fallback_symlink
 
         self._mode = None
         self._size = None
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -59,14 +59,12 @@
        int size;
        int mtime;
        PyObject *parentfiledata;
+       PyObject *fallback_exec;
+       PyObject *fallback_symlink;
        static char *keywords_name[] = {
-           "wc_tracked",
-           "p1_tracked",
-           "p2_info",
-           "has_meaningful_data",
-           "has_meaningful_mtime",
-           "parentfiledata",
-           NULL,
+           "wc_tracked",          "p1_tracked",           "p2_info",
+           "has_meaningful_data", "has_meaningful_mtime", "parentfiledata",
+           "fallback_exec",       "fallback_symlink",     NULL,
        };
        wc_tracked = 0;
        p1_tracked = 0;
@@ -74,10 +72,13 @@
        has_meaningful_mtime = 1;
        has_meaningful_data = 1;
        parentfiledata = Py_None;
-       if (!PyArg_ParseTupleAndKeywords(
-               args, kwds, "|iiiiiO", keywords_name, &wc_tracked, &p1_tracked,
-               &p2_info, &has_meaningful_data, &has_meaningful_mtime,
-               &parentfiledata)) {
+       fallback_exec = Py_None;
+       fallback_symlink = Py_None;
+       if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iiiiiOOO", keywords_name,
+                                        &wc_tracked, &p1_tracked, &p2_info,
+                                        &has_meaningful_data,
+                                        &has_meaningful_mtime, &parentfiledata,
+                                        &fallback_exec, &fallback_symlink)) {
                return NULL;
        }
        t = (dirstateItemObject *)subtype->tp_alloc(subtype, 1);
@@ -96,6 +97,19 @@
                t->flags |= dirstate_flag_p2_info;
        }
 
+       if (fallback_exec != Py_None) {
+               t->flags |= dirstate_flag_has_fallback_exec;
+               if (PyObject_IsTrue(fallback_exec)) {
+                       t->flags |= dirstate_flag_fallback_exec;
+               }
+       }
+       if (fallback_symlink != Py_None) {
+               t->flags |= dirstate_flag_has_fallback_symlink;
+               if (PyObject_IsTrue(fallback_symlink)) {
+                       t->flags |= dirstate_flag_fallback_symlink;
+               }
+       }
+
        if (parentfiledata != Py_None) {
                if (!PyTuple_CheckExact(parentfiledata)) {
                        PyErr_SetString(



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to