rust/rhg/src/commands/status.rs
changeset 48391 b80e5e75d51e
parent 48349 c12ed33558cb
child 48409 005ae1a343f8
equal deleted inserted replaced
48390:322525db4c98 48391:b80e5e75d51e
    10 use crate::utils::path_utils::relativize_paths;
    10 use crate::utils::path_utils::relativize_paths;
    11 use clap::{Arg, SubCommand};
    11 use clap::{Arg, SubCommand};
    12 use format_bytes::format_bytes;
    12 use format_bytes::format_bytes;
    13 use hg;
    13 use hg;
    14 use hg::config::Config;
    14 use hg::config::Config;
    15 use hg::dirstate::{has_exec_bit, TruncatedTimestamp};
    15 use hg::dirstate::has_exec_bit;
    16 use hg::errors::HgError;
    16 use hg::errors::HgError;
    17 use hg::manifest::Manifest;
    17 use hg::manifest::Manifest;
    18 use hg::matchers::AlwaysMatcher;
    18 use hg::matchers::AlwaysMatcher;
    19 use hg::repo::Repo;
    19 use hg::repo::Repo;
    20 use hg::utils::files::get_bytes_from_os_string;
    20 use hg::utils::files::get_bytes_from_os_string;
   192 
   192 
   193     let repo = invocation.repo?;
   193     let repo = invocation.repo?;
   194     let mut dmap = repo.dirstate_map_mut()?;
   194     let mut dmap = repo.dirstate_map_mut()?;
   195 
   195 
   196     let options = StatusOptions {
   196     let options = StatusOptions {
   197         // TODO should be provided by the dirstate parsing and
       
   198         // hence be stored on dmap. Using a value that assumes we aren't
       
   199         // below the time resolution granularity of the FS and the
       
   200         // dirstate.
       
   201         last_normal_time: TruncatedTimestamp::new_truncate(0, 0),
       
   202         // we're currently supporting file systems with exec flags only
   197         // we're currently supporting file systems with exec flags only
   203         // anyway
   198         // anyway
   204         check_exec: true,
   199         check_exec: true,
   205         list_clean: display_states.clean,
   200         list_clean: display_states.clean,
   206         list_unknown: display_states.unknown,
   201         list_unknown: display_states.unknown,
   367 ) -> Result<bool, HgError> {
   362 ) -> Result<bool, HgError> {
   368     let vfs = repo.working_directory_vfs();
   363     let vfs = repo.working_directory_vfs();
   369     let fs_path = hg_path_to_os_string(hg_path).expect("HgPath conversion");
   364     let fs_path = hg_path_to_os_string(hg_path).expect("HgPath conversion");
   370     let fs_metadata = vfs.symlink_metadata(&fs_path)?;
   365     let fs_metadata = vfs.symlink_metadata(&fs_path)?;
   371     let is_symlink = fs_metadata.file_type().is_symlink();
   366     let is_symlink = fs_metadata.file_type().is_symlink();
   372     // TODO: Also account for `FALLBACK_SYMLINK` and `FALLBACK_EXEC` from the dirstate
   367     // TODO: Also account for `FALLBACK_SYMLINK` and `FALLBACK_EXEC` from the
       
   368     // dirstate
   373     let fs_flags = if is_symlink {
   369     let fs_flags = if is_symlink {
   374         Some(b'l')
   370         Some(b'l')
   375     } else if has_exec_bit(&fs_metadata) {
   371     } else if has_exec_bit(&fs_metadata) {
   376         Some(b'x')
   372         Some(b'x')
   377     } else {
   373     } else {