diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c --- a/mercurial/cext/parsers.c +++ b/mercurial/cext/parsers.c @@ -567,6 +567,14 @@ Py_RETURN_FALSE; } }; +static PyObject *dirstate_item_get_p1_tracked(dirstateItemObject *self) +{ + if (self->flags & dirstate_flag_p1_tracked) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } +}; static PyObject *dirstate_item_get_added(dirstateItemObject *self) { @@ -642,6 +650,8 @@ {"mtime", (getter)dirstate_item_get_mtime, NULL, "mtime", NULL}, {"state", (getter)dirstate_item_get_state, NULL, "state", NULL}, {"tracked", (getter)dirstate_item_get_tracked, NULL, "tracked", NULL}, + {"p1_tracked", (getter)dirstate_item_get_p1_tracked, NULL, "p1_tracked", + 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}, diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -301,6 +301,11 @@ return True @property + def p1_tracked(self): + """True if the file is tracked in the first parent manifest""" + return self._p1_tracked + + @property def p2_info(self): """True if the file needed to merge or apply any input from p2 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 @@ -153,6 +153,10 @@ self.flags.contains(Flags::WDIR_TRACKED) } + pub fn p1_tracked(&self) -> bool { + self.flags.contains(Flags::P1_TRACKED) + } + fn in_either_parent(&self) -> bool { self.flags.intersects(Flags::P1_TRACKED | Flags::P2_INFO) } 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 @@ -67,6 +67,11 @@ } @property + def p1_tracked(&self) -> PyResult { + Ok(self.entry(py).get().p1_tracked()) + } + + @property def added(&self) -> PyResult { Ok(self.entry(py).get().added()) }