Show More
@@ -118,6 +118,38 b' static PySequenceMethods dirstate_tuple_' | |||
|
118 | 118 | 0 /* sq_inplace_repeat */ |
|
119 | 119 | }; |
|
120 | 120 | |
|
121 | static PyObject *dirstatetuple_v1_state(dirstateTupleObject *self) | |
|
122 | { | |
|
123 | return PyBytes_FromStringAndSize(&self->state, 1); | |
|
124 | }; | |
|
125 | ||
|
126 | static PyObject *dirstatetuple_v1_mode(dirstateTupleObject *self) | |
|
127 | { | |
|
128 | return PyInt_FromLong(self->mode); | |
|
129 | }; | |
|
130 | ||
|
131 | static PyObject *dirstatetuple_v1_size(dirstateTupleObject *self) | |
|
132 | { | |
|
133 | return PyInt_FromLong(self->size); | |
|
134 | }; | |
|
135 | ||
|
136 | static PyObject *dirstatetuple_v1_mtime(dirstateTupleObject *self) | |
|
137 | { | |
|
138 | return PyInt_FromLong(self->mtime); | |
|
139 | }; | |
|
140 | ||
|
141 | static PyMethodDef dirstatetuple_methods[] = { | |
|
142 | {"v1_state", (PyCFunction)dirstatetuple_v1_state, METH_NOARGS, | |
|
143 | "return a \"state\" suitable for v1 serialization"}, | |
|
144 | {"v1_mode", (PyCFunction)dirstatetuple_v1_mode, METH_NOARGS, | |
|
145 | "return a \"mode\" suitable for v1 serialization"}, | |
|
146 | {"v1_size", (PyCFunction)dirstatetuple_v1_size, METH_NOARGS, | |
|
147 | "return a \"size\" suitable for v1 serialization"}, | |
|
148 | {"v1_mtime", (PyCFunction)dirstatetuple_v1_mtime, METH_NOARGS, | |
|
149 | "return a \"mtime\" suitable for v1 serialization"}, | |
|
150 | {NULL} /* Sentinel */ | |
|
151 | }; | |
|
152 | ||
|
121 | 153 | PyTypeObject dirstateTupleType = { |
|
122 | 154 | PyVarObject_HEAD_INIT(NULL, 0) /* header */ |
|
123 | 155 | "dirstate_tuple", /* tp_name */ |
@@ -146,7 +178,7 b' PyTypeObject dirstateTupleType = {' | |||
|
146 | 178 | 0, /* tp_weaklistoffset */ |
|
147 | 179 | 0, /* tp_iter */ |
|
148 | 180 | 0, /* tp_iternext */ |
|
149 |
|
|
|
181 | dirstatetuple_methods, /* tp_methods */ | |
|
150 | 182 | 0, /* tp_members */ |
|
151 | 183 | 0, /* tp_getset */ |
|
152 | 184 | 0, /* tp_base */ |
@@ -64,6 +64,22 b' class dirstatetuple(object):' | |||
|
64 | 64 | else: |
|
65 | 65 | raise IndexError(idx) |
|
66 | 66 | |
|
67 | def v1_state(self): | |
|
68 | """return a "state" suitable for v1 serialization""" | |
|
69 | return self._state | |
|
70 | ||
|
71 | def v1_mode(self): | |
|
72 | """return a "mode" suitable for v1 serialization""" | |
|
73 | return self._mode | |
|
74 | ||
|
75 | def v1_size(self): | |
|
76 | """return a "size" suitable for v1 serialization""" | |
|
77 | return self._size | |
|
78 | ||
|
79 | def v1_mtime(self): | |
|
80 | """return a "mtime" suitable for v1 serialization""" | |
|
81 | return self._mtime | |
|
82 | ||
|
67 | 83 | |
|
68 | 84 | def gettype(q): |
|
69 | 85 | return int(q & 0xFFFF) |
@@ -450,7 +466,14 b' def pack_dirstate(dmap, copymap, pl, now' | |||
|
450 | 466 | |
|
451 | 467 | if f in copymap: |
|
452 | 468 | f = b"%s\0%s" % (f, copymap[f]) |
|
453 | e = _pack(b">cllll", e[0], e[1], e[2], e[3], len(f)) | |
|
469 | e = _pack( | |
|
470 | b">cllll", | |
|
471 | e.v1_state(), | |
|
472 | e.v1_mode(), | |
|
473 | e.v1_size(), | |
|
474 | e.v1_mtime(), | |
|
475 | len(f), | |
|
476 | ) | |
|
454 | 477 | write(e) |
|
455 | 478 | write(f) |
|
456 | 479 | return cs.getvalue() |
General Comments 0
You need to be logged in to leave comments.
Login now