D10143: rhg: Exit with an error code if `files` finds nothing
SimonSapin
phabricator at mercurial-scm.org
Tue Mar 9 09:42:51 UTC 2021
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D10143
AFFECTED FILES
rust/rhg/src/commands/files.rs
CHANGE DETAILS
diff --git a/rust/rhg/src/commands/files.rs b/rust/rhg/src/commands/files.rs
--- a/rust/rhg/src/commands/files.rs
+++ b/rust/rhg/src/commands/files.rs
@@ -59,11 +59,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)
+ }
}
To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list