##// END OF EJS Templates
rhg: fix race when an ambiguous file is deleted on disk...
rhg: fix race when an ambiguous file is deleted on disk There are two places in the status code where we handle files whose status we are unsure of based off of metadata alone: this one is the first one to actually disambiguate, and the second one is later in the code (but updated in the previous commit) for files that are actually clean to update the dirstate. Since there is a chance that the contents have changed between those two moments, we need to stat the files again, since re-using the old stat could lie about the clean state of the file.

File last commit:

r46195:426294d0 default
r51121:8fcd5302 stable
Show More
main.rs
39 lines | 1.4 KiB | application/rls-services+xml | RustLexer
Gregory Szorc
hgcli: add stub PyOxidizer project...
r45128 use pyembed::MainPythonInterpreter;
// Include an auto-generated file containing the default
// `pyembed::PythonConfig` derived by the PyOxidizer configuration file.
//
// If you do not want to use PyOxidizer to generate this file, simply
// remove this line and instantiate your own instance of
// `pyembed::PythonConfig`.
include!(env!("PYOXIDIZER_DEFAULT_PYTHON_CONFIG_RS"));
fn main() {
Martin von Zweigbergk
rust: move rustfmt.toml to repo root so it can be used by `hg fix`...
r46195 // The following code is in a block so the MainPythonInterpreter is
// destroyed in an orderly manner, before process exit.
Gregory Szorc
hgcli: add stub PyOxidizer project...
r45128 let code = {
Martin von Zweigbergk
rust: move rustfmt.toml to repo root so it can be used by `hg fix`...
r46195 // Load the default Python configuration as derived by the PyOxidizer
// config file used at build time.
Gregory Szorc
hgcli: add stub PyOxidizer project...
r45128 let config = default_python_config();
Martin von Zweigbergk
rust: move rustfmt.toml to repo root so it can be used by `hg fix`...
r46195 // Construct a new Python interpreter using that config, handling any
// errors from construction.
Gregory Szorc
hgcli: add stub PyOxidizer project...
r45128 match MainPythonInterpreter::new(config) {
Ok(mut interp) => {
Martin von Zweigbergk
rust: move rustfmt.toml to repo root so it can be used by `hg fix`...
r46195 // And run it using the default run configuration as specified
// by the configuration. If an uncaught Python
// exception is raised, handle it.
// This includes the special SystemExit, which is a request to
// terminate the process.
Gregory Szorc
hgcli: add stub PyOxidizer project...
r45128 interp.run_as_main()
}
Err(msg) => {
eprintln!("{}", msg);
1
}
}
};
// And exit the process according to code execution results.
std::process::exit(code);
}