##// END OF EJS Templates
dirstate-item: introduce a `dm_nonnormal` property...
marmoute -
r48485:265cdfaa default
parent child Browse files
Show More
@@ -142,6 +142,15 static PyObject *dirstate_item_v1_mtime(
142 return PyInt_FromLong(self->mtime);
142 return PyInt_FromLong(self->mtime);
143 };
143 };
144
144
145 static PyObject *dm_nonnormal(dirstateItemObject *self)
146 {
147 if (self->state != 'n' || self->mtime == ambiguous_time) {
148 Py_RETURN_TRUE;
149 } else {
150 Py_RETURN_FALSE;
151 }
152 };
153
145 static PyObject *dirstate_item_need_delay(dirstateItemObject *self,
154 static PyObject *dirstate_item_need_delay(dirstateItemObject *self,
146 PyObject *value)
155 PyObject *value)
147 {
156 {
@@ -221,6 +230,8 static PyMethodDef dirstate_item_methods
221 "build a new DirstateItem object from V1 data"},
230 "build a new DirstateItem object from V1 data"},
222 {"set_possibly_dirty", (PyCFunction)dirstate_item_set_possibly_dirty,
231 {"set_possibly_dirty", (PyCFunction)dirstate_item_set_possibly_dirty,
223 METH_NOARGS, "mark a file as \"possibly dirty\""},
232 METH_NOARGS, "mark a file as \"possibly dirty\""},
233 {"dm_nonnormal", (PyCFunction)dm_nonnormal, METH_NOARGS,
234 "True is the entry is non-normal in the dirstatemap sense"},
224 {NULL} /* Sentinel */
235 {NULL} /* Sentinel */
225 };
236 };
226
237
@@ -196,8 +196,8 class dirstatemap(object):
196 self._dirs.addpath(f)
196 self._dirs.addpath(f)
197 if old_entry is None and "_alldirs" in self.__dict__:
197 if old_entry is None and "_alldirs" in self.__dict__:
198 self._alldirs.addpath(f)
198 self._alldirs.addpath(f)
199 self._map[f] = DirstateItem(state, mode, size, mtime)
199 e = self._map[f] = DirstateItem(state, mode, size, mtime)
200 if state != b'n' or mtime == AMBIGUOUS_TIME:
200 if e.dm_nonnormal:
201 self.nonnormalset.add(f)
201 self.nonnormalset.add(f)
202 if size == FROM_P2:
202 if size == FROM_P2:
203 self.otherparentset.add(f)
203 self.otherparentset.add(f)
@@ -274,7 +274,7 class dirstatemap(object):
274 nonnorm = set()
274 nonnorm = set()
275 otherparent = set()
275 otherparent = set()
276 for fname, e in pycompat.iteritems(self._map):
276 for fname, e in pycompat.iteritems(self._map):
277 if e.state != b'n' or e.mtime == AMBIGUOUS_TIME:
277 if e.dm_nonnormal:
278 nonnorm.add(fname)
278 nonnorm.add(fname)
279 if e.from_p2:
279 if e.from_p2:
280 otherparent.add(fname)
280 otherparent.add(fname)
@@ -187,6 +187,14 class DirstateItem(object):
187 """
187 """
188 return self._state == b'r' and self._size == NONNORMAL
188 return self._state == b'r' and self._size == NONNORMAL
189
189
190 @property
191 def dm_nonnormal(self):
192 """True is the entry is non-normal in the dirstatemap sense
193
194 There is no reason for any code, but the dirstatemap one to use this.
195 """
196 return self.state != b'n' or self.mtime == AMBIGUOUS_TIME
197
190 def v1_state(self):
198 def v1_state(self):
191 """return a "state" suitable for v1 serialization"""
199 """return a "state" suitable for v1 serialization"""
192 return self._state
200 return self._state
General Comments 0
You need to be logged in to leave comments. Login now