parsers: update ntrev when we stop scanning
This prevents us from inserting some nodes twice, wasting work.
--- a/mercurial/parsers.c Tue May 08 15:46:51 2012 -0500
+++ b/mercurial/parsers.c Tue May 08 14:46:06 2012 -0700
@@ -690,10 +690,14 @@
} else {
for (rev = self->ntrev - 1; rev >= 0; rev--) {
const char *n = index_node(self, rev);
- if (n == NULL)
+ if (n == NULL) {
+ self->ntrev = rev + 1;
return -2;
- if (nt_insert(self, n, rev) == -1)
+ }
+ if (nt_insert(self, n, rev) == -1) {
+ self->ntrev = rev + 1;
return -3;
+ }
if (memcmp(node, n, nodelen > 20 ? 20 : nodelen) == 0) {
break;
}