[PATCH] dirstate: track non-normal files separately
Yuya Nishihara
yuya at tcha.org
Fri Dec 11 08:50:08 CST 2015
On Wed, 9 Dec 2015 15:56:32 -0800, Laurent Charignon wrote:
> # HG changeset patch
> # User Laurent Charignon <lcharignon at fb.com>
> # Date 1449705375 28800
> # Wed Dec 09 15:56:15 2015 -0800
> # Branch stable
> # Node ID 04249d53c997f653ae3488992a49f4df09c6a8b6
> # Parent f5e8cb813a4d5c0665c7e144d96810b4763c42d1
> dirstate: track non-normal files separately
> @@ -633,6 +646,7 @@ class dirstate(object):
> if "_dirs" in self.__dict__:
> delattr(self, "_dirs")
> self._copymap = {}
> + self._nonnormalmap = {}
> self._pl = [nullid, nullid]
> self._lastnormaltime = 0
> self._dirty = True
Perhaps dirstate.rebuild() has to do something because it doesn't call
clear() if changedfiles are specified.
I'm a little afraid of this change as it would be easy to introduce bugs
that don't update _nonnormalmap appropriately. And they aren't covered by
tests yet?
> --- a/mercurial/parsers.c
> +++ b/mercurial/parsers.c
> @@ -465,18 +465,26 @@ PyTypeObject dirstateTupleType = {
>
> static PyObject *parse_dirstate(PyObject *self, PyObject *args)
> {
> - PyObject *dmap, *cmap, *parents = NULL, *ret = NULL;
> - PyObject *fname = NULL, *cname = NULL, *entry = NULL;
> + PyObject *dmap, *cmap, *nonnmap, *parents = NULL, *ret = NULL;
> + PyObject *fname = NULL, *cname = NULL, *entry = NULL, *statestring = NULL;
> char state, *cur, *str, *cpos;
> int mode, size, mtime;
> unsigned int flen, len, pos = 40;
> int readlen;
>
> - if (!PyArg_ParseTuple(args, "O!O!s#:parse_dirstate",
> + if (!PyArg_ParseTuple(args, "O!O!O!s#:parse_dirstate",
> &PyDict_Type, &dmap,
> &PyDict_Type, &cmap,
> - &str, &readlen))
> - goto quit;
> + &PyDict_Type, &nonnmap,
> + &str, &readlen)) {
Maybe it needs PyErr_Clear().
> + /* It might be the old call signature */
> + nonnmap = NULL;
> + if (!PyArg_ParseTuple(args, "O!O!s#:parse_dirstate",
> + &PyDict_Type, &dmap,
> + &PyDict_Type, &cmap,
> + &str, &readlen))
> + goto quit;
> + }
Last time we've added suffix "2" to the function name and wrap callers by
try-except.
More information about the Mercurial-devel
mailing list