##// END OF EJS Templates
dirstate-entry: add `modified` property...
Raphaël Gomès -
r50715:3eac9250 default
parent child Browse files
Show More
@@ -177,7 +177,7 b' static inline bool dirstate_item_c_remov'
177 (dirstate_flag_p1_tracked | dirstate_flag_p2_info));
177 (dirstate_flag_p1_tracked | dirstate_flag_p2_info));
178 }
178 }
179
179
180 static inline bool dirstate_item_c_merged(dirstateItemObject *self)
180 static inline bool dirstate_item_c_modified(dirstateItemObject *self)
181 {
181 {
182 return ((self->flags & dirstate_flag_wc_tracked) &&
182 return ((self->flags & dirstate_flag_wc_tracked) &&
183 (self->flags & dirstate_flag_p1_tracked) &&
183 (self->flags & dirstate_flag_p1_tracked) &&
@@ -195,7 +195,7 b' static inline char dirstate_item_c_v1_st'
195 {
195 {
196 if (dirstate_item_c_removed(self)) {
196 if (dirstate_item_c_removed(self)) {
197 return 'r';
197 return 'r';
198 } else if (dirstate_item_c_merged(self)) {
198 } else if (dirstate_item_c_modified(self)) {
199 return 'm';
199 return 'm';
200 } else if (dirstate_item_c_added(self)) {
200 } else if (dirstate_item_c_added(self)) {
201 return 'a';
201 return 'a';
@@ -642,9 +642,9 b' static PyObject *dirstate_item_get_p2_in'
642 }
642 }
643 };
643 };
644
644
645 static PyObject *dirstate_item_get_merged(dirstateItemObject *self)
645 static PyObject *dirstate_item_get_modified(dirstateItemObject *self)
646 {
646 {
647 if (dirstate_item_c_merged(self)) {
647 if (dirstate_item_c_modified(self)) {
648 Py_RETURN_TRUE;
648 Py_RETURN_TRUE;
649 } else {
649 } else {
650 Py_RETURN_FALSE;
650 Py_RETURN_FALSE;
@@ -709,7 +709,7 b' static PyGetSetDef dirstate_item_getset['
709 NULL},
709 NULL},
710 {"added", (getter)dirstate_item_get_added, NULL, "added", NULL},
710 {"added", (getter)dirstate_item_get_added, NULL, "added", NULL},
711 {"p2_info", (getter)dirstate_item_get_p2_info, NULL, "p2_info", NULL},
711 {"p2_info", (getter)dirstate_item_get_p2_info, NULL, "p2_info", NULL},
712 {"merged", (getter)dirstate_item_get_merged, NULL, "merged", NULL},
712 {"modified", (getter)dirstate_item_get_modified, NULL, "modified", NULL},
713 {"from_p2", (getter)dirstate_item_get_from_p2, NULL, "from_p2", NULL},
713 {"from_p2", (getter)dirstate_item_get_from_p2, NULL, "from_p2", NULL},
714 {"maybe_clean", (getter)dirstate_item_get_maybe_clean, NULL, "maybe_clean",
714 {"maybe_clean", (getter)dirstate_item_get_maybe_clean, NULL, "maybe_clean",
715 NULL},
715 NULL},
@@ -1187,7 +1187,7 b' void dirs_module_init(PyObject *mod);'
1187 void manifest_module_init(PyObject *mod);
1187 void manifest_module_init(PyObject *mod);
1188 void revlog_module_init(PyObject *mod);
1188 void revlog_module_init(PyObject *mod);
1189
1189
1190 static const int version = 20;
1190 static const int version = 21;
1191
1191
1192 static void module_init(PyObject *mod)
1192 static void module_init(PyObject *mod)
1193 {
1193 {
@@ -76,7 +76,7 b' def _importfrom(pkgname, modname):'
76 ('cext', 'bdiff'): 3,
76 ('cext', 'bdiff'): 3,
77 ('cext', 'mpatch'): 1,
77 ('cext', 'mpatch'): 1,
78 ('cext', 'osutil'): 4,
78 ('cext', 'osutil'): 4,
79 ('cext', 'parsers'): 20,
79 ('cext', 'parsers'): 21,
80 }
80 }
81
81
82 # map import request to other package or module
82 # map import request to other package or module
@@ -435,6 +435,11 b' class DirstateItem:'
435 return self._wc_tracked and not (self._p1_tracked or self._p2_info)
435 return self._wc_tracked and not (self._p1_tracked or self._p2_info)
436
436
437 @property
437 @property
438 def modified(self):
439 """True if the file has been modified"""
440 return self._wc_tracked and self._p1_tracked and self._p2_info
441
442 @property
438 def maybe_clean(self):
443 def maybe_clean(self):
439 """True if the file has a chance to be in the "clean" state"""
444 """True if the file has a chance to be in the "clean" state"""
440 if not self._wc_tracked:
445 if not self._wc_tracked:
@@ -151,6 +151,10 b' py_class!(pub class DirstateItem |py| {'
151 Ok(self.entry(py).get().added())
151 Ok(self.entry(py).get().added())
152 }
152 }
153
153
154 @property
155 def modified(&self) -> PyResult<bool> {
156 Ok(self.entry(py).get().modified())
157 }
154
158
155 @property
159 @property
156 def p2_info(&self) -> PyResult<bool> {
160 def p2_info(&self) -> PyResult<bool> {
General Comments 0
You need to be logged in to leave comments. Login now