shortest: don't include nullid in disambigution revset
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 08 Aug 2018 22:26:57 -0700
changeset 39069 4c4825db29e1
parent 39068 52e9bf215f96
child 39070 4dd92a15fcca
shortest: don't include nullid in disambigution revset As noted by Yuya in the review of D4118, the fact that the nodetree always contains the nullid is not what we want for the disambiguation case. It's not what the pure version of the code does. Note that the updated test also passes before this patch, but it wouldn't have passed in native-code mode once we start using the nodetree for disambiguating nodeid prefixes. Differential Revision: https://phab.mercurial-scm.org/D4163
mercurial/cext/revlog.c
tests/test-revisions.t
--- a/mercurial/cext/revlog.c	Wed Aug 08 21:52:39 2018 -0700
+++ b/mercurial/cext/revlog.c	Wed Aug 08 22:26:57 2018 -0700
@@ -1075,10 +1075,6 @@
 		return -1;
 	}
 	self->length = 1;
-	if (nt_insert(self, nullid, -1) == -1) {
-		free(self->nodes);
-		return -1;
-	}
 	return 0;
 }
 
@@ -1152,6 +1148,11 @@
 			self->nt = NULL;
 			return -1;
 		}
+		if (nt_insert(self->nt, nullid, -1) == -1) {
+			PyMem_Free(self->nt);
+			self->nt = NULL;
+			return -1;
+		}
 		self->ntrev = (int)index_length(self);
 		self->ntlookups = 1;
 		self->ntmisses = 0;
--- a/tests/test-revisions.t	Wed Aug 08 21:52:39 2018 -0700
+++ b/tests/test-revisions.t	Wed Aug 08 22:26:57 2018 -0700
@@ -3,7 +3,7 @@
 
   $ echo 0 > a
   $ hg ci -qAm 0
-  $ for i in 5 8 14 43; do
+  $ for i in 5 8 14 43 167; do
   >   hg up -q 0
   >   echo $i > a
   >   hg ci -qm $i
@@ -14,6 +14,7 @@
   > EOF
 
   $ hg l
+  5:00f
   4:7ba5d
   3:7ba57
   2:72
@@ -21,9 +22,10 @@
   0:b
   $ cat <<EOF >> .hg/hgrc
   > [experimental]
-  > revisions.disambiguatewithin=:3
+  > revisions.disambiguatewithin=not 4
   > EOF
   $ hg l
+  5:0
   4:7ba5d
   3:7b
   2:72