aboutsummaryrefslogtreecommitdiff
path: root/xtask/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-02-12 18:20:27 +0000
committerGitHub <[email protected]>2021-02-12 18:20:27 +0000
commit935830d05bcf5f0c648e636dcbc8848a201467c0 (patch)
treeff289b26eb96e2dd9fdfaf24f5c73f0f2487a2d1 /xtask/src
parent88253907f4bc3beaa7b8f2e58cb652f653f92d56 (diff)
parent8814d1368d6712fd85074d77e33be610f01566c4 (diff)
Merge #7655
7655: Include a commit log summary in the changelog r=matklad a=lnicola This version omits any direct pushes, and maybe even pull requests merged from the GitHub UI. But I think it makes writing the release notes easier. Co-authored-by: LaurenČ›iu Nicola <[email protected]>
Diffstat (limited to 'xtask/src')
-rw-r--r--xtask/src/release.rs55
1 files changed, 32 insertions, 23 deletions
diff --git a/xtask/src/release.rs b/xtask/src/release.rs
index 93079b369..63556476d 100644
--- a/xtask/src/release.rs
+++ b/xtask/src/release.rs
@@ -1,3 +1,5 @@
1use std::fmt::Write;
2
1use xshell::{cmd, cp, pushd, read_dir, write_file}; 3use xshell::{cmd, cp, pushd, read_dir, write_file};
2 4
3use crate::{codegen, date_iso, is_release_tag, project_root, Mode, Result}; 5use crate::{codegen, date_iso, is_release_tag, project_root, Mode, Result};
@@ -24,6 +26,34 @@ impl ReleaseCmd {
24 let commit = cmd!("git rev-parse HEAD").read()?; 26 let commit = cmd!("git rev-parse HEAD").read()?;
25 let changelog_n = read_dir(changelog_dir.as_path())?.len(); 27 let changelog_n = read_dir(changelog_dir.as_path())?.len();
26 28
29 for &adoc in [
30 "manual.adoc",
31 "generated_assists.adoc",
32 "generated_config.adoc",
33 "generated_diagnostic.adoc",
34 "generated_features.adoc",
35 ]
36 .iter()
37 {
38 let src = project_root().join("./docs/user/").join(adoc);
39 let dst = website_root.join(adoc);
40 cp(src, dst)?;
41 }
42
43 let tags = cmd!("git tag --list").read()?;
44 let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap();
45
46 let git_log = cmd!("git log {prev_tag}..HEAD --merges --reverse").read()?;
47 let mut git_log_summary = String::new();
48 for line in git_log.lines() {
49 let line = line.trim_start();
50 if let Some(p) = line.find(':') {
51 if let Ok(pr) = line[..p].parse::<u32>() {
52 writeln!(git_log_summary, "* pr:{}[]{}", pr, &line[p + 1..]).unwrap();
53 }
54 }
55 }
56
27 let contents = format!( 57 let contents = format!(
28 "\ 58 "\
29= Changelog #{} 59= Changelog #{}
@@ -40,39 +70,18 @@ https://github.com/sponsors/rust-analyzer[GitHub Sponsors].
40 70
41== New Features 71== New Features
42 72
43* pr:[] . 73{}
44 74
45== Fixes 75== Fixes
46 76
47== Internal Improvements 77== Internal Improvements
48", 78",
49 changelog_n, commit, today 79 changelog_n, commit, today, git_log_summary
50 ); 80 );
51 81
52 let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n)); 82 let path = changelog_dir.join(format!("{}-changelog-{}.adoc", today, changelog_n));
53 write_file(&path, &contents)?; 83 write_file(&path, &contents)?;
54 84
55 for &adoc in [
56 "manual.adoc",
57 "generated_assists.adoc",
58 "generated_config.adoc",
59 "generated_diagnostic.adoc",
60 "generated_features.adoc",
61 ]
62 .iter()
63 {
64 let src = project_root().join("./docs/user/").join(adoc);
65 let dst = website_root.join(adoc);
66 cp(src, dst)?;
67 }
68
69 let tags = cmd!("git tag --list").read()?;
70 let prev_tag = tags.lines().filter(|line| is_release_tag(line)).last().unwrap();
71
72 let git_log = cmd!("git log {prev_tag}..HEAD --merges --reverse").read()?;
73 let git_log_dst = website_root.join("git.log");
74 write_file(git_log_dst, &git_log)?;
75
76 Ok(()) 85 Ok(())
77 } 86 }
78} 87}