diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c --- a/mercurial/cext/parsers.c +++ b/mercurial/cext/parsers.c @@ -177,7 +177,7 @@ static inline bool dirstate_item_c_remov (dirstate_flag_p1_tracked | dirstate_flag_p2_info)); } -static inline bool dirstate_item_c_merged(dirstateItemObject *self) +static inline bool dirstate_item_c_modified(dirstateItemObject *self) { return ((self->flags & dirstate_flag_wc_tracked) && (self->flags & dirstate_flag_p1_tracked) && @@ -195,7 +195,7 @@ static inline char dirstate_item_c_v1_st { if (dirstate_item_c_removed(self)) { return 'r'; - } else if (dirstate_item_c_merged(self)) { + } else if (dirstate_item_c_modified(self)) { return 'm'; } else if (dirstate_item_c_added(self)) { return 'a'; @@ -642,9 +642,9 @@ static PyObject *dirstate_item_get_p2_in } }; -static PyObject *dirstate_item_get_merged(dirstateItemObject *self) +static PyObject *dirstate_item_get_modified(dirstateItemObject *self) { - if (dirstate_item_c_merged(self)) { + if (dirstate_item_c_modified(self)) { Py_RETURN_TRUE; } else { Py_RETURN_FALSE; @@ -709,7 +709,7 @@ static PyGetSetDef dirstate_item_getset[ NULL}, {"added", (getter)dirstate_item_get_added, NULL, "added", NULL}, {"p2_info", (getter)dirstate_item_get_p2_info, NULL, "p2_info", NULL}, - {"merged", (getter)dirstate_item_get_merged, NULL, "merged", NULL}, + {"modified", (getter)dirstate_item_get_modified, NULL, "modified", 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}, @@ -1187,7 +1187,7 @@ void dirs_module_init(PyObject *mod); void manifest_module_init(PyObject *mod); void revlog_module_init(PyObject *mod); -static const int version = 20; +static const int version = 21; static void module_init(PyObject *mod) { diff --git a/mercurial/policy.py b/mercurial/policy.py --- a/mercurial/policy.py +++ b/mercurial/policy.py @@ -76,7 +76,7 @@ def _importfrom(pkgname, modname): ('cext', 'bdiff'): 3, ('cext', 'mpatch'): 1, ('cext', 'osutil'): 4, - ('cext', 'parsers'): 20, + ('cext', 'parsers'): 21, } # map import request to other package or module diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -435,6 +435,11 @@ class DirstateItem: return self._wc_tracked and not (self._p1_tracked or self._p2_info) @property + def modified(self): + """True if the file has been modified""" + return self._wc_tracked and self._p1_tracked and self._p2_info + + @property def maybe_clean(self): """True if the file has a chance to be in the "clean" state""" if not self._wc_tracked: 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 @@ -151,6 +151,10 @@ py_class!(pub class DirstateItem |py| { Ok(self.entry(py).get().added()) } + @property + def modified(&self) -> PyResult { + Ok(self.entry(py).get().modified()) + } @property def p2_info(&self) -> PyResult {