##// END OF EJS Templates
setup: further improve the error path for version retrieval...
setup: further improve the error path for version retrieval This is a new take at the problem that 8d390a13474d tried to tackle. There was two issues after that previous improvement: - the 0.0+ version could survive a bit too long and reaching the installer version and staying there. - multiple use case where still failing. So the new code is better at: - always succeeding when running `make local` so that we can bootstrap a local version - no using that fallback outside of `make local` to avoid distribution of version with the buggy version number. The setup.py is a gigantic pile of spaghetti code, to the point where pastafarian pilgrim started knocking at its core. However I refrained from cleaning that up since the more to a `setup.cfg` means this code should be deleted soon™.

File last commit:

r50809:58074252 default
r50988:010a1e73 stable
Show More
debugrhgsparse.rs
43 lines | 1.3 KiB | application/rls-services+xml | RustLexer
use std::os::unix::prelude::OsStrExt;
use crate::error::CommandError;
use clap::SubCommand;
use hg::{self, utils::hg_path::HgPath};
pub const HELP_TEXT: &str = "";
pub fn args() -> clap::App<'static, 'static> {
SubCommand::with_name("debugrhgsparse")
.arg(
clap::Arg::with_name("files")
.required(true)
.multiple(true)
.empty_values(false)
.value_name("FILES")
.help("Files to check against sparse profile"),
)
.about(HELP_TEXT)
}
pub fn run(invocation: &crate::CliInvocation) -> Result<(), CommandError> {
let repo = invocation.repo?;
let (matcher, _warnings) = hg::sparse::matcher(&repo).unwrap();
let files = invocation.subcommand_args.values_of_os("files");
if let Some(files) = files {
for file in files {
invocation.ui.write_stdout(b"matches: ")?;
invocation.ui.write_stdout(
if matcher.matches(HgPath::new(file.as_bytes())) {
b"yes"
} else {
b"no"
},
)?;
invocation.ui.write_stdout(b" | file: ")?;
invocation.ui.write_stdout(file.as_bytes())?;
invocation.ui.write_stdout(b"\n")?;
}
}
Ok(())
}