[Updated] D10979: dirstate-entry: add a `mode` property

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Jul 6 19:42:50 UTC 2021


Closed by commit rHG8e4b9fe31334: dirstate-entry: add a `mode` property (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D10979?vs=28881&id=28917

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D10979/new/

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

AFFECTED FILES
  mercurial/cext/parsers.c
  mercurial/dirstate.py
  mercurial/pure/parsers.py

CHANGE DETAILS

diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -72,6 +72,10 @@
             raise IndexError(idx)
 
     @property
+    def mode(self):
+        return self._mode
+
+    @property
     def state(self):
         """
         States are:
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1307,7 +1307,7 @@
             # general. That is much slower than simply accessing and storing the
             # tuple members one by one.
             t = dget(fn)
-            mode = t[1]
+            mode = t.mode
             size = t[2]
             time = t[3]
 
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -169,6 +169,11 @@
     {NULL} /* Sentinel */
 };
 
+static PyObject *dirstatetuple_get_mode(dirstateTupleObject *self)
+{
+	return PyInt_FromLong(self->mode);
+};
+
 static PyObject *dirstatetuple_get_state(dirstateTupleObject *self)
 {
 	return PyBytes_FromStringAndSize(&self->state, 1);
@@ -238,6 +243,7 @@
 };
 
 static PyGetSetDef dirstatetuple_getset[] = {
+    {"mode", (getter)dirstatetuple_get_mode, NULL, "mode", NULL},
     {"state", (getter)dirstatetuple_get_state, NULL, "state", NULL},
     {"tracked", (getter)dirstatetuple_get_tracked, NULL, "tracked", NULL},
     {"added", (getter)dirstatetuple_get_added, NULL, "added", NULL},



To: marmoute, #hg-reviewers, SimonSapin, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210706/29a625af/attachment-0002.html>


More information about the Mercurial-patches mailing list