D3558: revlog: handle errors from index_node() in nt_insert() and index_slice_del()
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Mon May 14 17:32:22 UTC 2018
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Same idea as in https://phab.mercurial-scm.org/rHGa9d9802d577e8c73e0d4316d178474d700f37bbd (revlog: don't say "not found" on
internal error, 2018-05-04).
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3558
AFFECTED FILES
mercurial/cext/revlog.c
CHANGE DETAILS
diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -1068,10 +1068,12 @@
return 0;
}
if (v < 0) {
- const char *oldnode = index_node(self, -(v + 1));
+ const char *oldnode = index_node_existing(self, -(v + 1));
int noff;
- if (!oldnode || !memcmp(oldnode, node, 20)) {
+ if (oldnode == NULL)
+ return -1;
+ if (!memcmp(oldnode, node, 20)) {
n->children[k] = -rev - 1;
return 0;
}
@@ -1850,10 +1852,11 @@
Py_ssize_t i;
for (i = start + 1; i < self->length - 1; i++) {
- const char *node = index_node(self, i);
+ const char *node = index_node_existing(self, i);
+ if (node == NULL)
+ return -1;
- if (node)
- nt_insert(self, node, -1);
+ nt_insert(self, node, -1);
}
if (self->added)
nt_invalidate_added(self, 0);
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list