From a33f4e0fd1faf60289903cacc89f649739c1b849 Mon Sep 17 00:00:00 2001 From: Rylan Polster Date: Mon, 28 Dec 2020 10:37:09 -0500 Subject: [PATCH] release-notes: show warning on recent major/minor tag --- Library/Homebrew/dev-cmd/release-notes.rb | 13 +++++++++++++ docs/Manpage.md | 4 ++++ manpages/brew.1 | 3 +++ 3 files changed, 20 insertions(+) diff --git a/Library/Homebrew/dev-cmd/release-notes.rb b/Library/Homebrew/dev-cmd/release-notes.rb index 925433ca87..1c9069af25 100644 --- a/Library/Homebrew/dev-cmd/release-notes.rb +++ b/Library/Homebrew/dev-cmd/release-notes.rb @@ -17,6 +17,10 @@ module Homebrew Print the merged pull requests on Homebrew/brew between two Git refs. If no is provided it defaults to the latest tag. If no is provided it defaults to `origin/master`. + + If `--markdown` and a are passed, an extra line containg + a link to the Homebrew blog will be adding to the output. Additionally, + a warning will be shown if the latest minor release was less than one month ago. EOS switch "--markdown", description: "Print as a Markdown list." @@ -29,6 +33,15 @@ module Homebrew args = release_notes_args.parse previous_tag = args.named.first + + if previous_tag.present? + + previous_tag_date = Date.parse Utils.popen_read( + "git", "-C", HOMEBREW_REPOSITORY, "log", "-1", "--format=%aI", previous_tag.sub(/\d+$/, "0") + ) + opoo "The latest major/minor release was less than one month ago." if previous_tag_date > (Date.today << 1) + end + previous_tag ||= Utils.popen_read( "git", "-C", HOMEBREW_REPOSITORY, "tag", "--list", "--sort=-version:refname" ).lines.first.chomp diff --git a/docs/Manpage.md b/docs/Manpage.md index 7bc638a186..edcf3931b1 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1197,6 +1197,10 @@ Print the merged pull requests on Homebrew/brew between two Git refs. If no *`previous_tag`* is provided it defaults to the latest tag. If no *`end_ref`* is provided it defaults to `origin/master`. +If `--markdown` and a *`previous_tag`* are passed, an extra line containg +a link to the Homebrew blog will be adding to the output. Additionally, +a warning will be shown if the latest minor release was less than one month ago. + * `--markdown`: Print as a Markdown list. diff --git a/manpages/brew.1 b/manpages/brew.1 index 5a8a4b8b13..b5f5de5e18 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1672,6 +1672,9 @@ Use \fBstackprof\fR instead of \fBruby\-prof\fR (the default)\. .SS "\fBrelease\-notes\fR [\fIoptions\fR] [\fIprevious_tag\fR] [\fIend_ref\fR]" Print the merged pull requests on Homebrew/brew between two Git refs\. If no \fIprevious_tag\fR is provided it defaults to the latest tag\. If no \fIend_ref\fR is provided it defaults to \fBorigin/master\fR\. . +.P +If \fB\-\-markdown\fR and a \fIprevious_tag\fR are passed, an extra line containg a link to the Homebrew blog will be adding to the output\. Additionally, a warning will be shown if the latest minor release was less than one month ago\. +. .TP \fB\-\-markdown\fR Print as a Markdown list\.