--- a/mercurial/parsers.c Mon Mar 06 09:28:33 2017 +0100
+++ b/mercurial/parsers.c Wed Mar 08 17:35:20 2017 -0800
@@ -560,11 +560,11 @@
}
/*
- * Build a set of non-normal entries from the dirstate dmap
+ * Build a set of non-normal and other parent entries from the dirstate dmap
*/
-static PyObject *nonnormalentries(PyObject *self, PyObject *args)
-{
- PyObject *dmap, *nonnset = NULL, *fname, *v;
+static PyObject *nonnormalotherparententries(PyObject *self, PyObject *args) {
+ PyObject *dmap, *fname, *v;
+ PyObject *nonnset = NULL, *otherpset = NULL, *result = NULL;
Py_ssize_t pos;
if (!PyArg_ParseTuple(args, "O!:nonnormalentries",
@@ -575,6 +575,10 @@
if (nonnset == NULL)
goto bail;
+ otherpset = PySet_New(NULL);
+ if (otherpset == NULL)
+ goto bail;
+
pos = 0;
while (PyDict_Next(dmap, &pos, &fname, &v)) {
dirstateTupleObject *t;
@@ -585,19 +589,53 @@
}
t = (dirstateTupleObject *)v;
+ if (t->state == 'n' && t->size == -2) {
+ if (PySet_Add(otherpset, fname) == -1) {
+ goto bail;
+ }
+ }
+
if (t->state == 'n' && t->mtime != -1)
continue;
if (PySet_Add(nonnset, fname) == -1)
goto bail;
}
- return nonnset;
+ result = Py_BuildValue("(OO)", nonnset, otherpset);
+ if (result == NULL)
+ goto bail;
+ return result;
bail:
Py_XDECREF(nonnset);
+ Py_XDECREF(otherpset);
+ Py_XDECREF(result);
return NULL;
}
/*
+ * Build a set of non-normal entries from the dirstate dmap
+*/
+static PyObject *nonnormalentries(PyObject *self, PyObject *args)
+{
+ PyObject *nonnset = NULL, *combined = NULL;
+
+ combined = nonnormalotherparententries(self, args);
+ if (!combined) {
+ return NULL;
+ }
+
+ nonnset = PyTuple_GetItem(combined, 0);
+ if (!nonnset) {
+ Py_DECREF(combined);
+ return NULL;
+ }
+
+ Py_INCREF(nonnset);
+ Py_DECREF(combined);
+ return nonnset;
+}
+
+/*
* Efficiently pack a dirstate object into its on-disk format.
*/
static PyObject *pack_dirstate(PyObject *self, PyObject *args)
@@ -2816,6 +2854,9 @@
{"pack_dirstate", pack_dirstate, METH_VARARGS, "pack a dirstate\n"},
{"nonnormalentries", nonnormalentries, METH_VARARGS,
"create a set containing non-normal entries of given dirstate\n"},
+ {"nonnormalotherparententries", nonnormalotherparententries, METH_VARARGS,
+ "create a set containing non-normal and other parent entries of given "
+ "dirstate\n"},
{"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"},
{"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"},
{"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"},