##// END OF EJS Templates
dirstate-entry: add a `removed` property...
marmoute -
r48304:c94d3ff4 default
parent child Browse files
Show More
@@ -175,10 +175,20 b' static PyObject *dirstatetuple_get_from_'
175 175 }
176 176 };
177 177
178 static PyObject *dirstatetuple_get_removed(dirstateTupleObject *self)
179 {
180 if (self->state == 'r') {
181 Py_RETURN_TRUE;
182 } else {
183 Py_RETURN_FALSE;
184 }
185 };
186
178 187 static PyGetSetDef dirstatetuple_getset[] = {
179 188 {"state", (getter)dirstatetuple_get_state, NULL, "state", NULL},
180 189 {"merged", (getter)dirstatetuple_get_merged, NULL, "merged", NULL},
181 190 {"from_p2", (getter)dirstatetuple_get_from_p2, NULL, "from_p2", NULL},
191 {"removed", (getter)dirstatetuple_get_removed, NULL, "removed", NULL},
182 192 {NULL} /* Sentinel */
183 193 };
184 194
@@ -472,7 +472,7 b' class dirstate(object):'
472 472 if self._map.hastrackeddir(d):
473 473 break
474 474 entry = self._map.get(d)
475 if entry is not None and entry.state != b'r':
475 if entry is not None and not entry.removed:
476 476 msg = _(b'file %r in dirstate clashes with %r')
477 477 msg %= (pycompat.bytestr(d), pycompat.bytestr(f))
478 478 raise error.Abort(msg)
@@ -531,9 +531,7 b' class dirstate(object):'
531 531 # being removed, restore that state.
532 532 entry = self._map.get(f)
533 533 if entry is not None:
534 if entry.state == b'r' and (
535 entry[2] == NONNORMAL or entry.from_p2
536 ):
534 if entry.removed and (entry[2] == NONNORMAL or entry.from_p2):
537 535 source = self._map.copymap.get(f)
538 536 if entry[2] == NONNORMAL:
539 537 self.merge(f)
@@ -1364,7 +1362,7 b' class dirstate(object):'
1364 1362 madd(fn)
1365 1363 elif state == b'a':
1366 1364 aadd(fn)
1367 elif state == b'r':
1365 elif t.removed:
1368 1366 radd(fn)
1369 1367 status = scmutil.status(
1370 1368 modified, added, removed, deleted, unknown, ignored, clean
@@ -99,6 +99,11 b' class dirstatetuple(object):'
99 99 """
100 100 return self._size == FROM_P2
101 101
102 @property
103 def removed(self):
104 """True if the file has been removed"""
105 return self._state == b'r'
106
102 107 def v1_state(self):
103 108 """return a "state" suitable for v1 serialization"""
104 109 return self._state
General Comments 0
You need to be logged in to leave comments. Login now