rust/rhg/src/commands/status.rs
changeset 49485 ffd4b1f1c9cb
parent 49483 b18e877ea304
child 49488 7c93e38a0bbd
equal deleted inserted replaced
49484:85f5d11c77dd 49485:ffd4b1f1c9cb
    16 use hg::dirstate::status::StatusPath;
    16 use hg::dirstate::status::StatusPath;
    17 use hg::dirstate::TruncatedTimestamp;
    17 use hg::dirstate::TruncatedTimestamp;
    18 use hg::errors::{HgError, IoResultExt};
    18 use hg::errors::{HgError, IoResultExt};
    19 use hg::lock::LockError;
    19 use hg::lock::LockError;
    20 use hg::manifest::Manifest;
    20 use hg::manifest::Manifest;
    21 use hg::matchers::AlwaysMatcher;
       
    22 use hg::repo::Repo;
    21 use hg::repo::Repo;
       
    22 use hg::sparse::{matcher, SparseWarning};
    23 use hg::utils::files::get_bytes_from_os_string;
    23 use hg::utils::files::get_bytes_from_os_string;
    24 use hg::utils::files::get_bytes_from_path;
    24 use hg::utils::files::get_bytes_from_path;
    25 use hg::utils::files::get_path_from_bytes;
    25 use hg::utils::files::get_path_from_bytes;
    26 use hg::utils::hg_path::{hg_path_to_path_buf, HgPath};
    26 use hg::utils::hg_path::{hg_path_to_path_buf, HgPath};
    27 use hg::DirstateStatus;
    27 use hg::DirstateStatus;
   249                 "verbose status output is not supported by rhg (and is needed because we're in an unfinished operation)",
   249                 "verbose status output is not supported by rhg (and is needed because we're in an unfinished operation)",
   250             ));
   250             ));
   251         };
   251         };
   252     }
   252     }
   253 
   253 
   254     if repo.has_sparse() || repo.has_narrow() {
   254     if repo.has_narrow() {
   255         return Err(CommandError::unsupported(
   255         return Err(CommandError::unsupported(
   256             "rhg status is not supported for sparse checkouts or narrow clones yet"
   256             "rhg status is not supported for narrow clones yet",
   257         ));
   257         ));
   258     }
   258     }
   259 
   259 
   260     let mut dmap = repo.dirstate_map_mut()?;
   260     let mut dmap = repo.dirstate_map_mut()?;
   261 
   261 
   364             fixup,
   364             fixup,
   365             dirstate_write_needed,
   365             dirstate_write_needed,
   366             filesystem_time_at_status_start,
   366             filesystem_time_at_status_start,
   367         ))
   367         ))
   368     };
   368     };
       
   369     let (matcher, sparse_warnings) = matcher(repo)?;
       
   370 
       
   371     for warning in sparse_warnings {
       
   372         match &warning {
       
   373             SparseWarning::RootWarning { context, line } => {
       
   374                 let msg = format_bytes!(
       
   375                     b"warning: {} profile cannot use paths \"
       
   376                     starting with /, ignoring {}\n",
       
   377                     context,
       
   378                     line
       
   379                 );
       
   380                 ui.write_stderr(&msg)?;
       
   381             }
       
   382             SparseWarning::ProfileNotFound { profile, rev } => {
       
   383                 let msg = format_bytes!(
       
   384                     b"warning: sparse profile '{}' not found \"
       
   385                     in rev {} - ignoring it\n",
       
   386                     profile,
       
   387                     rev
       
   388                 );
       
   389                 ui.write_stderr(&msg)?;
       
   390             }
       
   391             SparseWarning::Pattern(e) => {
       
   392                 ui.write_stderr(&print_pattern_file_warning(e, &repo))?;
       
   393             }
       
   394         }
       
   395     }
   369     let (fixup, mut dirstate_write_needed, filesystem_time_at_status_start) =
   396     let (fixup, mut dirstate_write_needed, filesystem_time_at_status_start) =
   370         dmap.with_status(
   397         dmap.with_status(
   371             &AlwaysMatcher,
   398             matcher.as_ref(),
   372             repo.working_directory_path().to_owned(),
   399             repo.working_directory_path().to_owned(),
   373             ignore_files(repo, config),
   400             ignore_files(repo, config),
   374             options,
   401             options,
   375             after_status,
   402             after_status,
   376         )?;
   403         )?;