[Updated] D10973: dirstate-entry: add a `tracked` property
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Tue Jul 6 19:13:38 UTC 2021
Closed by commit rHGf5b8f0b9c129: dirstate-entry: add a `tracked` 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/D10973?vs=28875&id=28912
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D10973/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D10973
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
@@ -87,6 +87,11 @@
return self._state
@property
+ def tracked(self):
+ """True is the file is tracked in the working copy"""
+ return self._state in b"nma"
+
+ @property
def added(self):
"""True if the file has been added"""
return self._state == b'a'
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1313,7 +1313,7 @@
size = t[2]
time = t[3]
- if not st and state in b"nma":
+ if not st and t.tracked:
dadd(fn)
elif state == b'n':
if (
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -158,6 +158,15 @@
return PyBytes_FromStringAndSize(&self->state, 1);
};
+static PyObject *dirstatetuple_get_tracked(dirstateTupleObject *self)
+{
+ if (self->state == 'a' || self->state == 'm' || self->state == 'n') {
+ Py_RETURN_TRUE;
+ } else {
+ Py_RETURN_FALSE;
+ }
+};
+
static PyObject *dirstatetuple_get_added(dirstateTupleObject *self)
{
if (self->state == 'a') {
@@ -214,6 +223,7 @@
static PyGetSetDef dirstatetuple_getset[] = {
{"state", (getter)dirstatetuple_get_state, NULL, "state", NULL},
+ {"tracked", (getter)dirstatetuple_get_tracked, NULL, "tracked", NULL},
{"added", (getter)dirstatetuple_get_added, NULL, "added", NULL},
{"merged_removed", (getter)dirstatetuple_get_merged_removed, NULL,
"merged_removed", 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/9395c890/attachment-0002.html>
More information about the Mercurial-patches
mailing list