##// END OF EJS Templates
dirstate-v2: Write .hg/dirstate back to disk on directory cache changes...
Simon Sapin -
r48139:04d1f17f default
parent child Browse files
Show More
@@ -1840,7 +1840,7 b' class workingctx(committablectx):'
1840 def _poststatusfixup(self, status, fixup):
1840 def _poststatusfixup(self, status, fixup):
1841 """update dirstate for files that are actually clean"""
1841 """update dirstate for files that are actually clean"""
1842 poststatus = self._repo.postdsstatus()
1842 poststatus = self._repo.postdsstatus()
1843 if fixup or poststatus:
1843 if fixup or poststatus or self._repo.dirstate._dirty:
1844 try:
1844 try:
1845 oldid = self._repo.dirstate.identity()
1845 oldid = self._repo.dirstate.identity()
1846
1846
@@ -1137,6 +1137,7 b' class dirstate(object):'
1137 warnings,
1137 warnings,
1138 bad,
1138 bad,
1139 traversed,
1139 traversed,
1140 dirty,
1140 ) = rustmod.status(
1141 ) = rustmod.status(
1141 self._map._rustmap,
1142 self._map._rustmap,
1142 matcher,
1143 matcher,
@@ -1150,6 +1151,8 b' class dirstate(object):'
1150 bool(matcher.traversedir),
1151 bool(matcher.traversedir),
1151 )
1152 )
1152
1153
1154 self._dirty |= dirty
1155
1153 if matcher.traversedir:
1156 if matcher.traversedir:
1154 for dir in traversed:
1157 for dir in traversed:
1155 matcher.traversedir(dir)
1158 matcher.traversedir(dir)
@@ -293,6 +293,10 b" pub struct DirstateStatus<'a> {"
293
293
294 /// Only filled if `collect_traversed_dirs` is `true`
294 /// Only filled if `collect_traversed_dirs` is `true`
295 pub traversed: Vec<HgPathCow<'a>>,
295 pub traversed: Vec<HgPathCow<'a>>,
296
297 /// Whether `status()` made changed to the `DirstateMap` that should be
298 /// written back to disk
299 pub dirty: bool,
296 }
300 }
297
301
298 #[derive(Debug, derive_more::From)]
302 #[derive(Debug, derive_more::From)]
@@ -919,6 +923,7 b" pub fn build_response<'a>("
919 bad,
923 bad,
920 unsure,
924 unsure,
921 traversed,
925 traversed,
926 dirty: false,
922 }
927 }
923 }
928 }
924
929
@@ -78,8 +78,9 b" pub fn status<'tree, 'on_disk: 'tree>("
78 root_cached_mtime,
78 root_cached_mtime,
79 is_at_repo_root,
79 is_at_repo_root,
80 )?;
80 )?;
81 let outcome = common.outcome.into_inner().unwrap();
81 let mut outcome = common.outcome.into_inner().unwrap();
82 let to_add = common.cached_directory_mtimes_to_add.into_inner().unwrap();
82 let to_add = common.cached_directory_mtimes_to_add.into_inner().unwrap();
83 outcome.dirty = !to_add.is_empty();
83 for (path, mtime) in &to_add {
84 for (path, mtime) in &to_add {
84 let node = DirstateMap::get_or_insert_node(
85 let node = DirstateMap::get_or_insert_node(
85 dmap.on_disk,
86 dmap.on_disk,
@@ -260,6 +260,7 b' fn build_response('
260 let unsure = collect_pybytes_list(py, status_res.unsure.as_ref());
260 let unsure = collect_pybytes_list(py, status_res.unsure.as_ref());
261 let bad = collect_bad_matches(py, status_res.bad.as_ref())?;
261 let bad = collect_bad_matches(py, status_res.bad.as_ref())?;
262 let traversed = collect_pybytes_list(py, status_res.traversed.as_ref());
262 let traversed = collect_pybytes_list(py, status_res.traversed.as_ref());
263 let dirty = status_res.dirty.to_py_object(py);
263 let py_warnings = PyList::new(py, &[]);
264 let py_warnings = PyList::new(py, &[]);
264 for warning in warnings.iter() {
265 for warning in warnings.iter() {
265 // We use duck-typing on the Python side for dispatch, good enough for
266 // We use duck-typing on the Python side for dispatch, good enough for
@@ -297,6 +298,7 b' fn build_response('
297 py_warnings.into_object(),
298 py_warnings.into_object(),
298 bad.into_object(),
299 bad.into_object(),
299 traversed.into_object(),
300 traversed.into_object(),
301 dirty.into_object(),
300 ][..],
302 ][..],
301 ))
303 ))
302 }
304 }
General Comments 0
You need to be logged in to leave comments. Login now