Skip to content

Commit 37e4366

Browse files
authored
Merge pull request #121 from camelid/improve-msg
Improve message for no CI builds found and various cleanup
2 parents 45b29a5 + 9c39e63 commit 37e4366

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

src/main.rs

+20-24
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ pub struct Commit {
3838
/// however, it does limit the amount of commits somewhat.
3939
const EPOCH_COMMIT: &str = "927c55d86b0be44337f37cf5b0a76fb8ba86e06c";
4040

41+
const REPORT_HEADER: &str = "\
42+
==================================================================================
43+
= Please file this regression report on the rust-lang/rust GitHub repository =
44+
= New issue: https://github.com/rust-lang/rust/issues/new =
45+
= Known issues: https://github.com/rust-lang/rust/issues =
46+
= Copy and paste the text below into the issue report thread. Thanks! =
47+
==================================================================================";
48+
4149
#[derive(Debug, StructOpt)]
4250
#[structopt(after_help = "EXAMPLES:
4351
Run a fully automatic nightly bisect doing `cargo check`:
@@ -682,12 +690,12 @@ fn print_results(cfg: &Config, client: &Client, bisection_result: &BisectionResu
682690
}
683691

684692
let tc_found = format!("Regression in {}", toolchains[*found]);
685-
eprintln!("");
686-
eprintln!("");
693+
eprintln!();
694+
eprintln!();
687695
eprintln!("{}", "*".repeat(80).dimmed().bold());
688696
eprintln!("{}", tc_found.red());
689697
eprintln!("{}", "*".repeat(80).dimmed().bold());
690-
eprintln!("");
698+
eprintln!();
691699
}
692700

693701
fn print_final_report(
@@ -707,20 +715,8 @@ fn print_final_report(
707715
..
708716
} = ci_bisection_result;
709717

710-
#[rustfmt::skip]
711-
eprintln!("{}", "==================================================================================".dimmed());
712-
#[rustfmt::skip]
713-
eprintln!("{}", "= Please file this regression report on the rust-lang/rust GitHub repository =".dimmed());
714-
#[rustfmt::skip]
715-
eprintln!("{}", "= New issue: https://github.com/rust-lang/rust/issues/new =".dimmed());
716-
#[rustfmt::skip]
717-
eprintln!("{}", "= Known issues: https://github.com/rust-lang/rust/issues =".dimmed());
718-
#[rustfmt::skip]
719-
eprintln!("{}", "= Copy and paste the text below into the issue report thread. Thanks! =".dimmed());
720-
#[rustfmt::skip]
721-
eprintln!("{}", "==================================================================================".dimmed());
722-
723-
eprintln!("");
718+
eprintln!("{}", REPORT_HEADER.dimmed());
719+
eprintln!();
724720

725721
let (start, end) = searched_range(cfg, nightly_toolchains);
726722

@@ -729,7 +725,7 @@ fn print_final_report(
729725
eprintln!("regressed nightly: {}", nightly_toolchains[*nightly_found],);
730726

731727
eprintln!(
732-
"searched commits: from https://github.com/rust-lang/rust/commit/{} to https://github.com/rust-lang/rust/commit/{1}",
728+
"searched commits: from https://github.com/rust-lang/rust/commit/{0} to https://github.com/rust-lang/rust/commit/{1}",
733729
ci_toolchains.first().unwrap(),
734730
ci_toolchains.last().unwrap(),
735731
);
@@ -739,15 +735,15 @@ fn print_final_report(
739735
ci_toolchains[*ci_found],
740736
);
741737

742-
eprintln!("");
738+
eprintln!();
743739
eprintln!("<details>");
744740
eprintln!(
745741
"<summary>bisected with <a href='{}'>cargo-bisect-rustc</a> v{}</summary>",
746742
env!("CARGO_PKG_REPOSITORY"),
747743
env!("CARGO_PKG_VERSION"),
748744
);
749-
eprintln!("");
750-
eprintln!("");
745+
eprintln!();
746+
eprintln!();
751747
if let Some(host) = option_env!("HOST") {
752748
eprintln!("Host triple: {}", host);
753749
}
@@ -760,7 +756,7 @@ fn print_final_report(
760756
eprint!("{} ", arg.to_string_lossy());
761757
}
762758
}
763-
eprintln!("");
759+
eprintln!();
764760
eprintln!("```");
765761
eprintln!("</details>");
766762
}
@@ -1149,7 +1145,7 @@ fn bisect_ci_in_commits(
11491145

11501146
if commits.is_empty() {
11511147
bail!(
1152-
"no commits between {} and {} within last 167 days",
1148+
"no CI builds available between {} and {} within last 167 days",
11531149
start,
11541150
end
11551151
);
@@ -1162,7 +1158,7 @@ fn bisect_ci_in_commits(
11621158
}
11631159

11641160
eprintln!("validated commits found, specifying toolchains");
1165-
eprintln!("");
1161+
eprintln!();
11661162

11671163
let toolchains = commits
11681164
.into_iter()

0 commit comments

Comments
 (0)