Patchwork D3457: revlog: don't say "not found" on internal error

login
register
mail settings
Submitter phabricator
Date May 8, 2018, 12:47 p.m.
Message ID <cc371ba1be0666bee8e7135130f08434@localhost.localdomain>
Download mbox | patch
Permalink /patch/31337/
State Not Applicable
Headers show

Comments

phabricator - May 8, 2018, 12:47 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa9d9802d577e: revlog: don&#039;t say &quot;not found&quot; on internal error (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3457?vs=8482&id=8511

REVISION DETAIL
  https://phab.mercurial-scm.org/D3457

AFFECTED FILES
  mercurial/cext/revlog.c

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -1151,22 +1151,20 @@ 
 	 */
 	if (self->ntmisses++ < 4) {
 		for (rev = self->ntrev - 1; rev >= 0; rev--) {
-			const char *n = index_node(self, rev);
+			const char *n = index_node_existing(self, rev);
 			if (n == NULL)
-				return -2;
+				return -3;
 			if (memcmp(node, n, nodelen > 20 ? 20 : nodelen) == 0) {
 				if (nt_insert(self, n, rev) == -1)
 					return -3;
 				break;
 			}
 		}
 	} else {
 		for (rev = self->ntrev - 1; rev >= 0; rev--) {
-			const char *n = index_node(self, rev);
-			if (n == NULL) {
-				self->ntrev = rev + 1;
-				return -2;
-			}
+			const char *n = index_node_existing(self, rev);
+			if (n == NULL)
+				return -3;
 			if (nt_insert(self, n, rev) == -1) {
 				self->ntrev = rev + 1;
 				return -3;
@@ -1243,9 +1241,9 @@ 
 	if (self->ntrev > 0) {
 		/* ensure that the radix tree is fully populated */
 		for (rev = self->ntrev - 1; rev >= 0; rev--) {
-			const char *n = index_node(self, rev);
+			const char *n = index_node_existing(self, rev);
 			if (n == NULL)
-				return -2;
+				return -3;
 			if (nt_insert(self, n, rev) == -1)
 				return -3;
 		}