diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-12-15 10:05:37 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2025-12-15 10:05:37 +0800 |
| commit | ad60d1f5e46e0fbe2a5463a511c4fccc9b5198b5 (patch) | |
| tree | 1929fd1eb6a14a57b5875478e9eacea644e767d2 /crates/vcs_data/src/data/local/file_status.rs | |
| parent | a2906e73faa8ed45976d83e8ec88c3e6e34c24c8 (diff) | |
Add edit mapping action for sheet operations
Diffstat (limited to 'crates/vcs_data/src/data/local/file_status.rs')
| -rw-r--r-- | crates/vcs_data/src/data/local/file_status.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/vcs_data/src/data/local/file_status.rs b/crates/vcs_data/src/data/local/file_status.rs index 7841237..599e4a3 100644 --- a/crates/vcs_data/src/data/local/file_status.rs +++ b/crates/vcs_data/src/data/local/file_status.rs @@ -33,6 +33,9 @@ pub struct AnalyzeResult<'a> { /// Lost local files pub lost: HashSet<LostRelativePathBuf>, + /// Erased local files + pub erased: HashSet<LostRelativePathBuf>, + /// Modified local files (excluding moved files) /// For files that were both moved and modified, changes can only be detected after LocalSheet mapping is aligned with actual files pub modified: HashSet<ModifiedRelativePathBuf>, @@ -154,6 +157,23 @@ impl<'a> AnalyzeResult<'a> { .cloned() .collect(); + // Files that exist locally but not in remote + let mut erased_files: HashSet<PathBuf> = HashSet::new(); + + if let Some(cached_data) = &analyze_ctx.cached_sheet_data { + if let Some(local_sheet) = &analyze_ctx.local_sheet { + let cached_sheet_mapping = cached_data.mapping(); + let local_sheet_mapping = &local_sheet.data.mapping; + + // Find paths that exist in local sheet but not in cached sheet + for local_path in local_sheet_mapping.keys() { + if !cached_sheet_mapping.contains_key(local_path) { + erased_files.insert(local_path.clone()); + } + } + } + } + // Calculate hashes for new files let new_files_for_hash: Vec<PathBuf> = new_files .iter() @@ -231,6 +251,7 @@ impl<'a> AnalyzeResult<'a> { vfid.map(|vfid| (vfid, (from.clone(), to.clone()))) }) .collect(); + result.erased = erased_files; Ok(()) } @@ -299,6 +320,7 @@ impl<'a> AnalyzeResult<'a> { created: HashSet::new(), lost: HashSet::new(), modified: HashSet::new(), + erased: HashSet::new(), } } } |
