Show More
@@ -103,6 +103,36 b' static const char *const tuple_format = ' | |||
|
103 | 103 | /* A RevlogNG v1 index entry is 64 bytes long. */ |
|
104 | 104 | static const long v1_hdrsize = 64; |
|
105 | 105 | |
|
106 | static void raise_revlog_error(void) | |
|
107 | { | |
|
108 | PyObject *mod = NULL, *dict = NULL, *errclass = NULL; | |
|
109 | ||
|
110 | mod = PyImport_ImportModule("mercurial.error"); | |
|
111 | if (mod == NULL) { | |
|
112 | goto cleanup; | |
|
113 | } | |
|
114 | ||
|
115 | dict = PyModule_GetDict(mod); | |
|
116 | if (dict == NULL) { | |
|
117 | goto cleanup; | |
|
118 | } | |
|
119 | Py_INCREF(dict); | |
|
120 | ||
|
121 | errclass = PyDict_GetItemString(dict, "RevlogError"); | |
|
122 | if (errclass == NULL) { | |
|
123 | PyErr_SetString(PyExc_SystemError, | |
|
124 | "could not find RevlogError"); | |
|
125 | goto cleanup; | |
|
126 | } | |
|
127 | ||
|
128 | /* value of exception is ignored by callers */ | |
|
129 | PyErr_SetString(errclass, "RevlogError"); | |
|
130 | ||
|
131 | cleanup: | |
|
132 | Py_XDECREF(dict); | |
|
133 | Py_XDECREF(mod); | |
|
134 | } | |
|
135 | ||
|
106 | 136 | /* |
|
107 | 137 | * Return a pointer to the beginning of a RevlogNG record. |
|
108 | 138 | */ |
@@ -1284,36 +1314,6 b' static int index_find_node(indexObject *' | |||
|
1284 | 1314 | return -2; |
|
1285 | 1315 | } |
|
1286 | 1316 | |
|
1287 | static void raise_revlog_error(void) | |
|
1288 | { | |
|
1289 | PyObject *mod = NULL, *dict = NULL, *errclass = NULL; | |
|
1290 | ||
|
1291 | mod = PyImport_ImportModule("mercurial.error"); | |
|
1292 | if (mod == NULL) { | |
|
1293 | goto cleanup; | |
|
1294 | } | |
|
1295 | ||
|
1296 | dict = PyModule_GetDict(mod); | |
|
1297 | if (dict == NULL) { | |
|
1298 | goto cleanup; | |
|
1299 | } | |
|
1300 | Py_INCREF(dict); | |
|
1301 | ||
|
1302 | errclass = PyDict_GetItemString(dict, "RevlogError"); | |
|
1303 | if (errclass == NULL) { | |
|
1304 | PyErr_SetString(PyExc_SystemError, | |
|
1305 | "could not find RevlogError"); | |
|
1306 | goto cleanup; | |
|
1307 | } | |
|
1308 | ||
|
1309 | /* value of exception is ignored by callers */ | |
|
1310 | PyErr_SetString(errclass, "RevlogError"); | |
|
1311 | ||
|
1312 | cleanup: | |
|
1313 | Py_XDECREF(dict); | |
|
1314 | Py_XDECREF(mod); | |
|
1315 | } | |
|
1316 | ||
|
1317 | 1317 | static PyObject *index_getitem(indexObject *self, PyObject *value) |
|
1318 | 1318 | { |
|
1319 | 1319 | char *node; |
General Comments 0
You need to be logged in to leave comments.
Login now