diff --git a/docs/manpages/gbp-rpm-ch.xml b/docs/manpages/gbp-rpm-ch.xml index 86e4c766..b1fb17bf 100644 --- a/docs/manpages/gbp-rpm-ch.xml +++ b/docs/manpages/gbp-rpm-ch.xml @@ -29,6 +29,7 @@ FILEPATH FILEPATH + MESSAGE COMMITISH @@ -161,6 +162,16 @@ + + + + + + Use all commits from the Git history, overrides + . + + + COMMITTISH diff --git a/gbp/scripts/rpm_ch.py b/gbp/scripts/rpm_ch.py index 0ceb3093..b5763899 100644 --- a/gbp/scripts/rpm_ch.py +++ b/gbp/scripts/rpm_ch.py @@ -238,7 +238,9 @@ def guess_commit(section, repo, options): def get_start_commit(changelog, repo, options): """Get the start commit from which to generate new entries""" - if options.since: + if options.all: + since = None + elif options.since: since = options.since else: if changelog.sections: @@ -247,7 +249,7 @@ def get_start_commit(changelog, repo, options): since = None if not since: raise GbpError("Couldn't determine starting point from " - "changelog, please use the '--since' option") + "changelog, please use the '--since' or '--all'") gbp.log.info("Continuing from commit '%s'" % since) return since @@ -441,6 +443,9 @@ def build_parser(name): # Range group options range_grp.add_option("-s", "--since", dest="since", help="commit to start from (e.g. HEAD^^^, release/0.1.2)") + range_grp.add_option("--all", action="store_true", + help="use all commits from the Git history, overrides " + "--since") # Formatting group options format_grp.add_option("--no-release", action="store_false", default=True, dest="release", diff --git a/tests/component/rpm/test_rpm_ch.py b/tests/component/rpm/test_rpm_ch.py index 91c2358b..e640bb01 100644 --- a/tests/component/rpm/test_rpm_ch.py +++ b/tests/component/rpm/test_rpm_ch.py @@ -109,6 +109,16 @@ def test_create_changes_file(self): # Should contain 3 lines (header, 1 entry and an empty line) eq_(len(content), 3) + def test_option_all(self): + """Test the --all cmdline option""" + repo = self.init_test_repo('gbp-test2') + + eq_(mock_ch(['--changelog-file=CHANGES', '--all']), 0) + content = self.read_file('packaging/gbp-test2.changes') + # Should contain N+2 lines (header, N commits and an empty line) + commit_cnt = len(repo.get_commits(since=None, until='master')) + eq_(len(content), commit_cnt + 2) + def test_option_changelog_file(self): """Test the --changelog-file cmdline option""" repo = self.init_test_repo('gbp-test-native')