diff --git a/announce.sh b/announce.sh index 815e3ba..7d2f3b1 100755 --- a/announce.sh +++ b/announce.sh @@ -67,6 +67,12 @@ fi # fails because there are no other tags, we will produce the entire # history. PREVIOUS_VERSION=$(git describe --abbrev=0 ${VERSION}^ || echo "") +if [[ "$PREVIOUS_VERSION" = "" ]]; then + # There was no previous tag, so we're looking for the full history + # of the project. + PREVIOUS_VERSION=$(git rev-list --max-parents=0 HEAD) + first_release="--first-release" +fi # Extract the tag message by parsing the git show output, which looks # something like: @@ -135,6 +141,7 @@ release-notes \ $email_tags \ --series $SERIES \ $stable \ + $first_release \ . "$PREVIOUS_VERSION" "$VERSION" \ $include_pypi_link \ | tee $relnotes_file diff --git a/releasetools/cmds/release_notes.py b/releasetools/cmds/release_notes.py index 69cf083..4639241 100644 --- a/releasetools/cmds/release_notes.py +++ b/releasetools/cmds/release_notes.py @@ -45,6 +45,11 @@ def main(): default=False, help='include a pypi hyperlink for the library', ) + parser.add_argument('--first-release', + action='store_true', + default=False, + help='this is the first release of the project', + ) parser.add_argument("--skip-requirement-merges", action='store_true', default=False, help="skip requirement update commit messages" @@ -108,6 +113,7 @@ def main(): email_tags=args.email_tags, include_pypi_link=args.include_pypi_link, changes_only=args.changes_only, + first_release=args.first_release, ) print(notes.encode('utf-8')) return 0 diff --git a/releasetools/release_notes.py b/releasetools/release_notes.py index 5dd8f9e..2796888 100644 --- a/releasetools/release_notes.py +++ b/releasetools/release_notes.py @@ -73,6 +73,9 @@ We are {{ emotion }} to announce the release of: {{ project }} {{ end_rev }}: {{ description }} +{% if first_release -%} +This is the first release of {{project}}. +{%- endif %} {% if series -%} This release is part of the {{series}} {% if stable_series %}stable {% endif %}release series. {%- endif %} @@ -108,6 +111,7 @@ NOTE: Skipping requirement commits... {% for change in changes -%} {{ change }} {% endfor %} +{% if not first_release -%} Diffstat (except docs and test files) ------------------------------------- @@ -121,6 +125,7 @@ Requirements updates {% for change in requirement_changes -%} {{ change }} {% endfor %} +{%- endif %} {% endif %} """ @@ -189,6 +194,7 @@ def generate_release_notes(library, library_path, email_to, email_reply_to, email_tags, include_pypi_link, changes_only, + first_release, ): """Return the text of the release notes. @@ -214,6 +220,8 @@ def generate_release_notes(library, library_path, page. :param changes_only: Boolean indicating whether to limit output to the list of changes, without any extra data. + :param first_release: Boolean indicating whether this is the first + release of the project """ @@ -321,6 +329,7 @@ def generate_release_notes(library, library_path, 'email_reply_to': email_reply_to, 'email_tags': email_tags, 'reno_notes': reno_notes, + 'first_release': first_release, }) if include_pypi_link: params['pypi_url'] = PYPI_URL_TPL % library_name