未验证 提交 f1f34707 编写于 作者: M Mazdak Farrokhzad 提交者: GitHub

Rollup merge of #59309 - o01eg:verbose-copy-files, r=alexcrichton

Add messages for different verbosity levels. Output copy actions.
......@@ -726,6 +726,17 @@ fn verbose(&self, msg: &str) {
}
}
pub fn is_verbose_than(&self, level: usize) -> bool {
self.verbosity > level
}
/// Prints a message if this build is configured in more verbose mode than `level`.
fn verbose_than(&self, level: usize, msg: &str) {
if self.is_verbose_than(level) {
println!("{}", msg);
}
}
fn info(&self, msg: &str) {
if self.config.dry_run { return; }
println!("{}", msg);
......@@ -1158,6 +1169,7 @@ fn read_stamp_file(&self, stamp: &Path) -> Vec<(PathBuf, bool)> {
/// Copies a file from `src` to `dst`
pub fn copy(&self, src: &Path, dst: &Path) {
if self.config.dry_run { return; }
self.verbose_than(1, &format!("Copy {:?} to {:?}", src, dst));
let _ = fs::remove_file(&dst);
let metadata = t!(src.symlink_metadata());
if metadata.file_type().is_symlink() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册