changeset 16616:8f79aabd96f6

parsers: allow nt_find to signal an ambiguous match
author Bryan O'Sullivan <bryano@fb.com>
date Tue, 08 May 2012 14:48:44 -0700
parents 96fa9dd1db38
children 4fb16743049d
files mercurial/parsers.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)