| 81 | |
| 82 | |
| 83 | PyObject * |
| 84 | Stash_richcompare(PyObject *o1, PyObject *o2, int op) |
| 85 | { |
| 86 | int eq = 0; |
| 87 | Stash *s1, *s2; |
| 88 | git_oid *oid1, *oid2; |
| 89 | |
| 90 | /* We only support comparing to another stash */ |
| 91 | if (!PyObject_TypeCheck(o2, &StashType)) { |
| 92 | Py_INCREF(Py_NotImplemented); |
| 93 | return Py_NotImplemented; |
| 94 | } |
| 95 | |
| 96 | s1 = (Stash *)o1; |
| 97 | s2 = (Stash *)o2; |
| 98 | |
| 99 | oid1 = &((Oid *)s1->commit_id)->oid; |
| 100 | oid2 = &((Oid *)s2->commit_id)->oid; |
| 101 | |
| 102 | eq = git_oid_equal(oid1, oid2) && |
| 103 | (0 == strcmp(s1->message, s2->message)); |
| 104 | |
| 105 | switch (op) { |
| 106 | case Py_EQ: |
| 107 | if (eq) { |
| 108 | Py_RETURN_TRUE; |
| 109 | } else { |
| 110 | Py_RETURN_FALSE; |
| 111 | } |
| 112 | case Py_NE: |
| 113 | if (eq) { |
| 114 | Py_RETURN_FALSE; |
| 115 | } else { |
| 116 | Py_RETURN_TRUE; |
| 117 | } |
| 118 | default: |
| 119 | Py_INCREF(Py_NotImplemented); |
| 120 | return Py_NotImplemented; |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | |
| 125 | PyGetSetDef Stash_getseters[] = { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…