changeset 16614:1d800eb9ba52

parsers: update ntrev when we stop scanning This prevents us from inserting some nodes twice, wasting work.
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 08 May 2012 14:46:06 -0700
parents 6a7ce975edd6
children 96fa9dd1db38
files mercurial/parsers.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;
 			}