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:
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
# 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",
# 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')