##// END OF EJS Templates
rust-status: make `DirEntry` attributes clearer
Raphaël Gomès -
r50458:6b32d39e default
parent child Browse files
Show More
@@ -414,7 +414,7 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
414 let dirstate_nodes = dirstate_nodes.sorted();
414 let dirstate_nodes = dirstate_nodes.sorted();
415 // `sort_unstable_by_key` doesn’t allow keys borrowing from the value:
415 // `sort_unstable_by_key` doesn’t allow keys borrowing from the value:
416 // https://github.com/rust-lang/rust/issues/34162
416 // https://github.com/rust-lang/rust/issues/34162
417 fs_entries.sort_unstable_by(|e1, e2| e1.base_name.cmp(&e2.base_name));
417 fs_entries.sort_unstable_by(|e1, e2| e1.hg_path.cmp(&e2.hg_path));
418
418
419 // Propagate here any error that would happen inside the comparison
419 // Propagate here any error that would happen inside the comparison
420 // callback below
420 // callback below
@@ -430,7 +430,7 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
430 dirstate_node
430 dirstate_node
431 .base_name(self.dmap.on_disk)
431 .base_name(self.dmap.on_disk)
432 .unwrap()
432 .unwrap()
433 .cmp(&fs_entry.base_name)
433 .cmp(&fs_entry.hg_path)
434 },
434 },
435 )
435 )
436 .par_bridge()
436 .par_bridge()
@@ -440,7 +440,7 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
440 match pair {
440 match pair {
441 Both(dirstate_node, fs_entry) => {
441 Both(dirstate_node, fs_entry) => {
442 self.traverse_fs_and_dirstate(
442 self.traverse_fs_and_dirstate(
443 &fs_entry.full_path,
443 &fs_entry.fs_path,
444 &fs_entry.metadata,
444 &fs_entry.metadata,
445 dirstate_node,
445 dirstate_node,
446 has_ignored_ancestor,
446 has_ignored_ancestor,
@@ -737,7 +737,7 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
737 directory_hg_path: &HgPath,
737 directory_hg_path: &HgPath,
738 fs_entry: &DirEntry,
738 fs_entry: &DirEntry,
739 ) -> bool {
739 ) -> bool {
740 let hg_path = directory_hg_path.join(&fs_entry.base_name);
740 let hg_path = directory_hg_path.join(&fs_entry.hg_path);
741 let file_type = fs_entry.metadata.file_type();
741 let file_type = fs_entry.metadata.file_type();
742 let file_or_symlink = file_type.is_file() || file_type.is_symlink();
742 let file_or_symlink = file_type.is_file() || file_type.is_symlink();
743 if file_type.is_dir() {
743 if file_type.is_dir() {
@@ -755,7 +755,7 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
755 let is_at_repo_root = false;
755 let is_at_repo_root = false;
756 if let Ok(children_fs_entries) = self.read_dir(
756 if let Ok(children_fs_entries) = self.read_dir(
757 &hg_path,
757 &hg_path,
758 &fs_entry.full_path,
758 &fs_entry.fs_path,
759 is_at_repo_root,
759 is_at_repo_root,
760 ) {
760 ) {
761 children_fs_entries.par_iter().for_each(|child_fs_entry| {
761 children_fs_entries.par_iter().for_each(|child_fs_entry| {
@@ -821,8 +821,10 b" impl<'a, 'tree, 'on_disk> StatusCommon<'"
821 }
821 }
822
822
823 struct DirEntry {
823 struct DirEntry {
824 base_name: HgPathBuf,
824 /// Path as stored in the dirstate
825 full_path: PathBuf,
825 hg_path: HgPathBuf,
826 /// Filesystem path
827 fs_path: PathBuf,
826 metadata: std::fs::Metadata,
828 metadata: std::fs::Metadata,
827 }
829 }
828
830
@@ -872,8 +874,8 b' impl DirEntry {'
872 };
874 };
873 let base_name = get_bytes_from_os_string(file_name).into();
875 let base_name = get_bytes_from_os_string(file_name).into();
874 results.push(DirEntry {
876 results.push(DirEntry {
875 base_name,
877 hg_path: base_name,
876 full_path,
878 fs_path: full_path,
877 metadata,
879 metadata,
878 })
880 })
879 }
881 }
General Comments 0
You need to be logged in to leave comments. Login now