##// 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 static PyGetSetDef dirstatetuple_getset[] = {
187 static PyGetSetDef dirstatetuple_getset[] = {
179 {"state", (getter)dirstatetuple_get_state, NULL, "state", NULL},
188 {"state", (getter)dirstatetuple_get_state, NULL, "state", NULL},
180 {"merged", (getter)dirstatetuple_get_merged, NULL, "merged", NULL},
189 {"merged", (getter)dirstatetuple_get_merged, NULL, "merged", NULL},
181 {"from_p2", (getter)dirstatetuple_get_from_p2, NULL, "from_p2", NULL},
190 {"from_p2", (getter)dirstatetuple_get_from_p2, NULL, "from_p2", NULL},
191 {"removed", (getter)dirstatetuple_get_removed, NULL, "removed", NULL},
182 {NULL} /* Sentinel */
192 {NULL} /* Sentinel */
183 };
193 };
184
194
@@ -472,7 +472,7 b' class dirstate(object):'
472 if self._map.hastrackeddir(d):
472 if self._map.hastrackeddir(d):
473 break
473 break
474 entry = self._map.get(d)
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 msg = _(b'file %r in dirstate clashes with %r')
476 msg = _(b'file %r in dirstate clashes with %r')
477 msg %= (pycompat.bytestr(d), pycompat.bytestr(f))
477 msg %= (pycompat.bytestr(d), pycompat.bytestr(f))
478 raise error.Abort(msg)
478 raise error.Abort(msg)
@@ -531,9 +531,7 b' class dirstate(object):'
531 # being removed, restore that state.
531 # being removed, restore that state.
532 entry = self._map.get(f)
532 entry = self._map.get(f)
533 if entry is not None:
533 if entry is not None:
534 if entry.state == b'r' and (
534 if entry.removed and (entry[2] == NONNORMAL or entry.from_p2):
535 entry[2] == NONNORMAL or entry.from_p2
536 ):
537 source = self._map.copymap.get(f)
535 source = self._map.copymap.get(f)
538 if entry[2] == NONNORMAL:
536 if entry[2] == NONNORMAL:
539 self.merge(f)
537 self.merge(f)
@@ -1364,7 +1362,7 b' class dirstate(object):'
1364 madd(fn)
1362 madd(fn)
1365 elif state == b'a':
1363 elif state == b'a':
1366 aadd(fn)
1364 aadd(fn)
1367 elif state == b'r':
1365 elif t.removed:
1368 radd(fn)
1366 radd(fn)
1369 status = scmutil.status(
1367 status = scmutil.status(
1370 modified, added, removed, deleted, unknown, ignored, clean
1368 modified, added, removed, deleted, unknown, ignored, clean
@@ -99,6 +99,11 b' class dirstatetuple(object):'
99 """
99 """
100 return self._size == FROM_P2
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 def v1_state(self):
107 def v1_state(self):
103 """return a "state" suitable for v1 serialization"""
108 """return a "state" suitable for v1 serialization"""
104 return self._state
109 return self._state
General Comments 0
You need to be logged in to leave comments. Login now