##// END OF EJS Templates
localrepo: warn if we are writing to cache without a lock...
localrepo: warn if we are writing to cache without a lock From quite sometime we have two types of cache, `cache` and `wcache`. The later one is a working copy cache and the first one is a store cache. Let's add a check for warning if we are missing store lock while writing to these caches. This is inspired from some tag cache breakage which is observed when multiple shares are in play. The interesting part is that although we are still taking wlock to write store caches at many places, but still the test pases. Differential Revision: https://phab.mercurial-scm.org/D9000

File last commit:

r45924:26440adb default
r46003:324ad3e7 default
Show More
main.rs
57 lines | 1.6 KiB | application/rls-services+xml | RustLexer
use clap::App;
use clap::AppSettings;
use clap::SubCommand;
mod commands;
mod error;
mod exitcode;
mod ui;
use commands::Command;
fn main() {
let mut app = App::new("rhg")
.setting(AppSettings::AllowInvalidUtf8)
.setting(AppSettings::SubcommandRequired)
.setting(AppSettings::VersionlessSubcommands)
.version("0.0.1")
.subcommand(
SubCommand::with_name("root").about(commands::root::HELP_TEXT),
)
.subcommand(
SubCommand::with_name("files").about(commands::files::HELP_TEXT),
);
let matches = app.clone().get_matches_safe().unwrap_or_else(|_| {
std::process::exit(exitcode::UNIMPLEMENTED_COMMAND)
});
let ui = ui::Ui::new();
let command_result = match matches.subcommand_name() {
Some(name) => match name {
"root" => commands::root::RootCommand::new(&ui).run(),
"files" => commands::files::FilesCommand::new(&ui).run(),
_ => std::process::exit(exitcode::UNIMPLEMENTED_COMMAND),
},
_ => {
match app.print_help() {
Ok(_) => std::process::exit(exitcode::OK),
Err(_) => std::process::exit(exitcode::ABORT),
};
}
};
match command_result {
Ok(_) => std::process::exit(exitcode::OK),
Err(e) => {
let message = e.get_error_message_bytes();
if let Some(msg) = message {
match ui.write_stderr(&msg) {
Ok(_) => (),
Err(_) => std::process::exit(exitcode::ABORT),
};
};
e.exit()
}
}
}