parsers: allow nt_find to signal an ambiguous match
authorBryan O'Sullivan <bryano@fb.com>
Tue, 08 May 2012 14:48:44 -0700
changeset 16616 8f79aabd96f6
parent 16615 96fa9dd1db38
child 16617 4fb16743049d
parsers: allow nt_find to signal an ambiguous match
mercurial/parsers.c
--- a/mercurial/parsers.c	Tue May 08 14:48:39 2012 -0700
+++ b/mercurial/parsers.c	Tue May 08 14:48:44 2012 -0700
@@ -544,6 +544,13 @@
 	return v & 0xf;
 }
 
+/*
+ * Return values:
+ *
+ *   -4: match is ambiguous (multiple candidates)
+ *   -2: not found
+ * rest: valid rev
+ */
 static int nt_find(indexObject *self, const char *node, Py_ssize_t nodelen)
 {
 	int level, off;
@@ -572,7 +579,8 @@
 			return -2;
 		off = v;
 	}
-	return -2;
+	/* multiple matches against an ambiguous prefix */
+	return -4;
 }
 
 static int nt_new(indexObject *self)