Mercurial > hg-stable
changeset 46758:63bfcddddac1
rhg: Exit with an error code if `files` finds nothing
This matches the behavior of Python-based hg.
Differential Revision: https://phab.mercurial-scm.org/D10143
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Mon, 08 Mar 2021 19:25:33 +0100 |
parents | b1f2c2b336ec |
children | eb14264b98e8 |
files | rust/rhg/src/commands/files.rs |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/rhg/src/commands/files.rs Wed Mar 03 16:40:03 2021 +0100 +++ b/rust/rhg/src/commands/files.rs Mon Mar 08 19:25:33 2021 +0100 @@ -61,11 +61,17 @@ let mut stdout = ui.stdout_buffer(); + let mut any = false; for file in files { + any = true; let file = working_directory.join(file); stdout.write_all(relativize_path(&file, &cwd).as_ref())?; stdout.write_all(b"\n")?; } stdout.flush()?; - Ok(()) + if any { + Ok(()) + } else { + Err(CommandError::Unsuccessful) + } }