From: Markus Lehtonen Date: Fri, 16 May 2014 11:26:49 +0000 (+0300) Subject: rpm-ch: implement '--all' option X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0358f9289b9d388b6f8229fb120a6cd3bc357a42;p=tools%2Fgit-buildpackage.git rpm-ch: implement '--all' option If defined, git-rpm-ch uses all commits in the Git history. Also, '--since' option is omitted. Signed-off-by: Markus Lehtonen --- diff --git a/gbp/scripts/rpm_ch.py b/gbp/scripts/rpm_ch.py index 30426fb4..65cfef2c 100755 --- a/gbp/scripts/rpm_ch.py +++ b/gbp/scripts/rpm_ch.py @@ -237,7 +237,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: @@ -246,7 +248,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 @@ -436,6 +438,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 810ea30b..e8f9b711 100644 --- a/tests/component/rpm/test_rpm_ch.py +++ b/tests/component/rpm/test_rpm_ch.py @@ -117,6 +117,16 @@ class TestRpmCh(RpmRepoTestBase): # 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')