Show More
@@ -248,6 +248,20 b' static const char *index_node(indexObjec' | |||
|
248 | 248 | return data ? data + 32 : NULL; |
|
249 | 249 | } |
|
250 | 250 | |
|
251 | /* | |
|
252 | * Return the 20-byte SHA of the node corresponding to the given rev. The | |
|
253 | * rev is assumed to be existing. If not, an exception is set. | |
|
254 | */ | |
|
255 | static const char *index_node_existing(indexObject *self, Py_ssize_t pos) | |
|
256 | { | |
|
257 | const char *node = index_node(self, pos); | |
|
258 | if (node == NULL) { | |
|
259 | PyErr_Format(PyExc_IndexError, "could not access rev %d", | |
|
260 | (int)pos); | |
|
261 | } | |
|
262 | return node; | |
|
263 | } | |
|
264 | ||
|
251 | 265 | static int nt_insert(indexObject *self, const char *node, int rev); |
|
252 | 266 | |
|
253 | 267 | static int node_check(PyObject *obj, char **node, Py_ssize_t *nodelen) |
@@ -1282,10 +1296,8 b' static PyObject *index_partialmatch(inde' | |||
|
1282 | 1296 | return PyBytes_FromStringAndSize(nullid, 20); |
|
1283 | 1297 | } |
|
1284 | 1298 | |
|
1285 | fullnode = index_node(self, rev); | |
|
1299 | fullnode = index_node_existing(self, rev); | |
|
1286 | 1300 | if (fullnode == NULL) { |
|
1287 | PyErr_Format(PyExc_IndexError, | |
|
1288 | "could not access rev %d", rev); | |
|
1289 | 1301 | return NULL; |
|
1290 | 1302 | } |
|
1291 | 1303 | return PyBytes_FromStringAndSize(fullnode, 20); |
General Comments 0
You need to be logged in to leave comments.
Login now