marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  It is useful to simplify various conditional that use `any_tracked and not
  added`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11586

AFFECTED FILES
  mercurial/cext/parsers.c
  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
@@ -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/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},



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to