[Commented On] D11585: dirstate-item: introduce a `p2_info` property that combine two others
baymax (Baymax, Your Personal Patch-care Companion)
phabricator at mercurial-scm.org
Sun Oct 3 10:51:36 UTC 2021
baymax added a comment.
baymax updated this revision to Diff 30591.
✅ refresh by Heptapod after a successful CI run (🐙 💚)
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11585?vs=30575&id=30591
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11585/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11585
AFFECTED FILES
mercurial/cext/parsers.c
mercurial/pure/parsers.py
rust/hg-core/src/dirstate/entry.rs
rust/hg-cpython/src/dirstate/item.rs
CHANGE DETAILS
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
@@ -71,6 +71,12 @@
Ok(self.entry(py).get().added())
}
+
+ @property
+ def p2_info(&self) -> PyResult<bool> {
+ Ok(self.entry(py).get().p2_info())
+ }
+
@property
def merged(&self) -> PyResult<bool> {
Ok(self.entry(py).get().merged())
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
@@ -161,6 +161,10 @@
self.in_either_parent() && !self.flags.contains(Flags::WDIR_TRACKED)
}
+ pub fn p2_info(&self) -> bool {
+ self.flags.contains(Flags::WDIR_TRACKED | Flags::P2_INFO)
+ }
+
pub fn merged(&self) -> bool {
self.flags
.contains(Flags::WDIR_TRACKED | Flags::P1_TRACKED | Flags::P2_INFO)
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,14 @@
return True
@property
+ def p2_info(self):
+ """True if the file needed to merge or apply any input from p2
+
+ See the class documentation for details.
+ """
+ return self._wc_tracked and self._p2_info
+
+ @property
def merged(self):
"""True if the file has been merged
diff --git a/mercurial/cext/parsers.c b/mercurial/cext/parsers.c
--- a/mercurial/cext/parsers.c
+++ b/mercurial/cext/parsers.c
@@ -577,6 +577,16 @@
}
};
+static PyObject *dirstate_item_get_p2_info(dirstateItemObject *self)
+{
+ if (self->flags & dirstate_flag_wc_tracked &&
+ self->flags & dirstate_flag_p2_info) {
+ Py_RETURN_TRUE;
+ } else {
+ Py_RETURN_FALSE;
+ }
+};
+
static PyObject *dirstate_item_get_merged(dirstateItemObject *self)
{
if (dirstate_item_c_merged(self)) {
@@ -633,6 +643,7 @@
{"state", (getter)dirstate_item_get_state, NULL, "state", NULL},
{"tracked", (getter)dirstate_item_get_tracked, NULL, "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},
{"from_p2", (getter)dirstate_item_get_from_p2, NULL, "from_p2", NULL},
{"maybe_clean", (getter)dirstate_item_get_maybe_clean, NULL, "maybe_clean",
To: marmoute, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211003/5fcb4311/attachment-0002.html>
More information about the Mercurial-patches
mailing list