Show More
@@ -547,6 +547,44 b' quit:' | |||
|
547 | 547 | } |
|
548 | 548 | |
|
549 | 549 | /* |
|
550 | * Build a set of non-normal entries from the dirstate dmap | |
|
551 | */ | |
|
552 | static PyObject *nonnormalentries(PyObject *self, PyObject *args) | |
|
553 | { | |
|
554 | PyObject *dmap, *nonnset = NULL, *fname, *v; | |
|
555 | Py_ssize_t pos; | |
|
556 | ||
|
557 | if (!PyArg_ParseTuple(args, "O!:nonnormalentries", | |
|
558 | &PyDict_Type, &dmap)) | |
|
559 | goto bail; | |
|
560 | ||
|
561 | nonnset = PySet_New(NULL); | |
|
562 | if (nonnset == NULL) | |
|
563 | goto bail; | |
|
564 | ||
|
565 | pos = 0; | |
|
566 | while (PyDict_Next(dmap, &pos, &fname, &v)) { | |
|
567 | dirstateTupleObject *t; | |
|
568 | if (!dirstate_tuple_check(v)) { | |
|
569 | PyErr_SetString(PyExc_TypeError, | |
|
570 | "expected a dirstate tuple"); | |
|
571 | goto bail; | |
|
572 | } | |
|
573 | t = (dirstateTupleObject *)v; | |
|
574 | ||
|
575 | if (t->state == 'n' && t->mtime != -1) | |
|
576 | continue; | |
|
577 | if (PySet_Add(nonnset, fname) == -1) | |
|
578 | goto bail; | |
|
579 | } | |
|
580 | ||
|
581 | return nonnset; | |
|
582 | bail: | |
|
583 | Py_XDECREF(nonnset); | |
|
584 | return NULL; | |
|
585 | } | |
|
586 | ||
|
587 | /* | |
|
550 | 588 | * Efficiently pack a dirstate object into its on-disk format. |
|
551 | 589 | */ |
|
552 | 590 | static PyObject *pack_dirstate(PyObject *self, PyObject *args) |
@@ -2740,6 +2778,8 b' PyObject *lowerencode(PyObject *self, Py' | |||
|
2740 | 2778 | |
|
2741 | 2779 | static PyMethodDef methods[] = { |
|
2742 | 2780 | {"pack_dirstate", pack_dirstate, METH_VARARGS, "pack a dirstate\n"}, |
|
2781 | {"nonnormalentries", nonnormalentries, METH_VARARGS, | |
|
2782 | "create a set containing non-normal entries of given dirstate\n"}, | |
|
2743 | 2783 | {"parse_manifest", parse_manifest, METH_VARARGS, "parse a manifest\n"}, |
|
2744 | 2784 | {"parse_dirstate", parse_dirstate, METH_VARARGS, "parse a dirstate\n"}, |
|
2745 | 2785 | {"parse_index2", parse_index2, METH_VARARGS, "parse a revlog index\n"}, |
General Comments 0
You need to be logged in to leave comments.
Login now