Mercurial > hg
diff mercurial/cext/parsers.c @ 48086:80783e553bd5
dirstate-item: introduce a `maybe_clean` property
It is useful for some extension that seek to invalidate some state.
Differential Revision: https://phab.mercurial-scm.org/D11523
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 29 Sep 2021 14:41:19 +0200 |
parents | 596510cd2b12 |
children | 79bc60ca5946 |
line wrap: on
line diff
--- a/mercurial/cext/parsers.c Wed Sep 29 02:37:24 2021 +0200 +++ b/mercurial/cext/parsers.c Wed Sep 29 14:41:19 2021 +0200 @@ -620,6 +620,21 @@ } }; +static PyObject *dirstate_item_get_maybe_clean(dirstateItemObject *self) +{ + if (!(self->flags & dirstate_flag_wc_tracked)) { + Py_RETURN_FALSE; + } else if (dirstate_item_c_added(self)) { + Py_RETURN_FALSE; + } else if (self->flags & dirstate_flag_merged) { + Py_RETURN_FALSE; + } else if (self->flags & dirstate_flag_clean_p2) { + Py_RETURN_FALSE; + } else { + Py_RETURN_TRUE; + } +}; + static PyObject *dirstate_item_get_removed(dirstateItemObject *self) { if (dirstate_item_c_removed(self)) { @@ -638,6 +653,8 @@ {"added", (getter)dirstate_item_get_added, NULL, "added", NULL}, {"merged", (getter)dirstate_item_get_merged, NULL, "merged", NULL}, {"from_p2", (getter)dirstate_item_get_from_p2, NULL, "from_p2", NULL}, + {"maybe_clean", (getter)dirstate_item_get_maybe_clean, NULL, "maybe_clean", + NULL}, {"removed", (getter)dirstate_item_get_removed, NULL, "removed", NULL}, {NULL} /* Sentinel */ };