##// END OF EJS Templates
parsers: strictly check for 20-byte hashes where they're required
Bryan O'Sullivan -
r16679:2950d186 stable
parent child Browse files
Show More
@@ -404,7 +404,7 b' class localrepository(repo.repository):'
404 # ignore tags to unknown nodes
404 # ignore tags to unknown nodes
405 self.changelog.rev(v)
405 self.changelog.rev(v)
406 t[k] = v
406 t[k] = v
407 except error.LookupError:
407 except (error.LookupError, ValueError):
408 pass
408 pass
409 return t
409 return t
410
410
@@ -753,7 +753,7 b' static PyObject *index_getitem(indexObje'
753 if (PyInt_Check(value))
753 if (PyInt_Check(value))
754 return index_get(self, PyInt_AS_LONG(value));
754 return index_get(self, PyInt_AS_LONG(value));
755
755
756 if (PyString_AsStringAndSize(value, &node, &nodelen) == -1)
756 if (node_check(value, &node, &nodelen) == -1)
757 return NULL;
757 return NULL;
758 rev = index_find_node(self, node, nodelen);
758 rev = index_find_node(self, node, nodelen);
759 if (rev >= -1)
759 if (rev >= -1)
@@ -765,12 +765,15 b' static PyObject *index_getitem(indexObje'
765
765
766 static PyObject *index_m_get(indexObject *self, PyObject *args)
766 static PyObject *index_m_get(indexObject *self, PyObject *args)
767 {
767 {
768 Py_ssize_t nodelen;
769 PyObject *val;
768 char *node;
770 char *node;
769 int nodelen, rev;
771 int rev;
770
772
771 if (!PyArg_ParseTuple(args, "s#", &node, &nodelen))
773 if (!PyArg_ParseTuple(args, "O", &val))
772 return NULL;
774 return NULL;
773
775 if (node_check(val, &node, &nodelen) == -1)
776 return NULL;
774 rev = index_find_node(self, node, nodelen);
777 rev = index_find_node(self, node, nodelen);
775 if (rev == -3)
778 if (rev == -3)
776 return NULL;
779 return NULL;
@@ -789,11 +792,8 b' static int index_contains(indexObject *s'
789 return rev >= -1 && rev < index_length(self);
792 return rev >= -1 && rev < index_length(self);
790 }
793 }
791
794
792 if (!PyString_Check(value))
795 if (node_check(value, &node, &nodelen) == -1)
793 return 0;
796 return -1;
794
795 node = PyString_AS_STRING(value);
796 nodelen = PyString_GET_SIZE(value);
797
797
798 switch (index_find_node(self, node, nodelen)) {
798 switch (index_find_node(self, node, nodelen)) {
799 case -3:
799 case -3:
General Comments 0
You need to be logged in to leave comments. Login now