##// END OF EJS Templates
dirstate-entry: add a `added` property...
marmoute -
r48315:8bcae9bf default
parent child Browse files
Show More
@@ -158,6 +158,15 b' static PyObject *dirstatetuple_get_state'
158 158 return PyBytes_FromStringAndSize(&self->state, 1);
159 159 };
160 160
161 static PyObject *dirstatetuple_get_added(dirstateTupleObject *self)
162 {
163 if (self->state == 'a') {
164 Py_RETURN_TRUE;
165 } else {
166 Py_RETURN_FALSE;
167 }
168 };
169
161 170 static PyObject *dirstatetuple_get_merged(dirstateTupleObject *self)
162 171 {
163 172 if (self->state == 'm') {
@@ -205,6 +214,7 b' static PyObject *dirstatetuple_get_remov'
205 214
206 215 static PyGetSetDef dirstatetuple_getset[] = {
207 216 {"state", (getter)dirstatetuple_get_state, NULL, "state", NULL},
217 {"added", (getter)dirstatetuple_get_added, NULL, "added", NULL},
208 218 {"merged_removed", (getter)dirstatetuple_get_merged_removed, NULL,
209 219 "merged_removed", NULL},
210 220 {"merged", (getter)dirstatetuple_get_merged, NULL, "merged", NULL},
@@ -1346,7 +1346,7 b' class dirstate(object):'
1346 1346 cadd(fn)
1347 1347 elif t.merged:
1348 1348 madd(fn)
1349 elif state == b'a':
1349 elif t.added:
1350 1350 aadd(fn)
1351 1351 elif t.removed:
1352 1352 radd(fn)
@@ -87,6 +87,11 b' class dirstatetuple(object):'
87 87 return self._state
88 88
89 89 @property
90 def added(self):
91 """True if the file has been added"""
92 return self._state == b'a'
93
94 @property
90 95 def merged(self):
91 96 """True if the file has been merged
92 97
General Comments 0
You need to be logged in to leave comments. Login now