Mercurial > hg
comparison mercurial/cext/revlog.c @ 39069:4c4825db29e1
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
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 08 Aug 2018 22:26:57 -0700 |
parents | 52e9bf215f96 |
children | 4dd92a15fcca |
comparison
equal
deleted
inserted
replaced
39068:52e9bf215f96 | 39069:4c4825db29e1 |
---|---|
1073 if (self->nodes == NULL) { | 1073 if (self->nodes == NULL) { |
1074 PyErr_NoMemory(); | 1074 PyErr_NoMemory(); |
1075 return -1; | 1075 return -1; |
1076 } | 1076 } |
1077 self->length = 1; | 1077 self->length = 1; |
1078 if (nt_insert(self, nullid, -1) == -1) { | |
1079 free(self->nodes); | |
1080 return -1; | |
1081 } | |
1082 return 0; | 1078 return 0; |
1083 } | 1079 } |
1084 | 1080 |
1085 static int nt_partialmatch(nodetree *self, const char *node, | 1081 static int nt_partialmatch(nodetree *self, const char *node, |
1086 Py_ssize_t nodelen) | 1082 Py_ssize_t nodelen) |
1146 PyErr_NoMemory(); | 1142 PyErr_NoMemory(); |
1147 return -1; | 1143 return -1; |
1148 } | 1144 } |
1149 unsigned capacity = (self->raw_length < 4 ? 4 : (int)self->raw_length / 2); | 1145 unsigned capacity = (self->raw_length < 4 ? 4 : (int)self->raw_length / 2); |
1150 if (nt_init(self->nt, self, capacity) == -1) { | 1146 if (nt_init(self->nt, self, capacity) == -1) { |
1147 PyMem_Free(self->nt); | |
1148 self->nt = NULL; | |
1149 return -1; | |
1150 } | |
1151 if (nt_insert(self->nt, nullid, -1) == -1) { | |
1151 PyMem_Free(self->nt); | 1152 PyMem_Free(self->nt); |
1152 self->nt = NULL; | 1153 self->nt = NULL; |
1153 return -1; | 1154 return -1; |
1154 } | 1155 } |
1155 self->ntrev = (int)index_length(self); | 1156 self->ntrev = (int)index_length(self); |