diff --git a/changelog.d/+easyblock-reach-header.bugfix.md b/changelog.d/+easyblock-reach-header.bugfix.md new file mode 100644 index 00000000..214e1caf --- /dev/null +++ b/changelog.d/+easyblock-reach-header.bugfix.md @@ -0,0 +1 @@ +`easyblock-reach` heads `reach.toml` and `reach.md` with a line that says only that `eb-stack easyblock-reach` generated the file, instead of the `pr-overlap` warning about a data branch that is never merged. The report is written to `--out-dir`, and no branch holds it. diff --git a/docs/orgmode/howto/easyblock-reach.org b/docs/orgmode/howto/easyblock-reach.org index 20aa3c1b..a3f6ebbf 100644 --- a/docs/orgmode/howto/easyblock-reach.org +++ b/docs/orgmode/howto/easyblock-reach.org @@ -45,9 +45,10 @@ module. The empty range ~HEAD..HEAD~ on that same checkout printed ~name/version[-toolchain]versionsuffix~. Blank lines and ~#~ comments are ignored. -The command writes ~reach.toml~, ~reach.json~, and ~reach.md~. The TOML -file starts with the generated-file header. The markdown opens with the -same warning as an HTML comment. Neither is a file to merge. +The command writes ~reach.toml~, ~reach.json~, and ~reach.md~ to +~--out-dir~. ~reach.toml~ starts with +~# Generated by `eb-stack easyblock-reach`.~, and ~reach.md~ opens with +the same line as an HTML comment. ~reach.json~ has no comment. * A commit range or a pull request diff --git a/llms-full.txt b/llms-full.txt index 5591be69..8d5f555e 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -2710,9 +2710,10 @@ module. The empty range `HEAD..HEAD` on that same checkout printed `name/version[-toolchain]versionsuffix`. Blank lines and `#` comments are ignored. -The command writes `reach.toml`, `reach.json`, and `reach.md`. The TOML -file starts with the generated-file header. The markdown opens with the -same warning as an HTML comment. Neither is a file to merge. +The command writes `reach.toml`, `reach.json`, and `reach.md` to +`--out-dir`. `reach.toml` starts with +`# Generated by `eb-stack easyblock-reach`.`, and `reach.md` opens with +the same line as an HTML comment. `reach.json` has no comment. # A commit range or a pull request diff --git a/src/easyblock_reach.rs b/src/easyblock_reach.rs index 51577c8d..5080a2da 100644 --- a/src/easyblock_reach.rs +++ b/src/easyblock_reach.rs @@ -486,7 +486,7 @@ fn collect_py(root: &Path, files: &mut Vec) -> std::io::Result<()> { } /// Header on every generated TOML file. -pub const GENERATED_HEADER: &str = "# Generated by `eb-stack easyblock-reach`. Data only: the branch holding this file is\n# regenerated on every run and must never be merged.\n"; +pub const GENERATED_HEADER: &str = "# Generated by `eb-stack easyblock-reach`.\n"; /// Why a reach report could not be built. #[derive(Debug, Error)] @@ -860,9 +860,7 @@ pub fn to_json(report: &ReachReport) -> Result { /// Reviewer markdown. The HTML comment marks the file as generated. pub fn render_markdown(report: &ReachReport) -> String { - let mut out = String::from( - "\n", - ); + let mut out = String::from("\n"); out.push_str(&format!( "# Easyblock reach ({})\n\n{} easyconfigs, {} already installed, {} modules that depend on a hit.\n\n", report.generated_at, report.easyconfig_count, report.installed_count, report.reverse.len() @@ -1520,7 +1518,7 @@ mod tests { toml::from_str(toml_text.trim_start_matches(GENERATED_HEADER)).unwrap(); assert_eq!(back, report); let json = to_json(&report).unwrap(); - assert!(!json.contains("never be merged")); + assert!(!json.contains("Generated by")); let md = render_markdown(&report); assert!(md.contains("GROMACS/2024.1")); assert!(md.contains("wrapper/1")); @@ -1534,6 +1532,34 @@ mod tests { assert_eq!(installed, BTreeSet::from(["zlib/1.3".into()])); } + /// The report is written to `--out-dir`; unlike `pr-overlap`, no data + /// branch holds it. + #[test] + fn the_generated_headers_name_no_branch() { + let report = ReachReport { + schema_version: REACH_SCHEMA_VERSION, + generated_at: "t".into(), + changed_files: Vec::new(), + changed_classes: Vec::new(), + reached_classes: Vec::new(), + easyconfig_count: 0, + installed_count: 0, + hits: Vec::new(), + reverse: Vec::new(), + skipped: Vec::new(), + }; + let toml_text = to_toml(&report).unwrap(); + assert_eq!( + toml_text.lines().next(), + Some("# Generated by `eb-stack easyblock-reach`.") + ); + assert_eq!( + render_markdown(&report).lines().next(), + Some("") + ); + assert!(!toml_text.contains("branch")); + } + fn git_ok(dir: &std::path::Path, args: &[&str]) { let output = std::process::Command::new("git") .arg("-C")