From c8dbfe1281926b45000360727e94d71f9a56deb0 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Thu, 5 Mar 2015 08:55:28 +0200 Subject: pq-rpm: implement --drop option Makes it possible to automatically drop the pq-branch after a successful export. Counterpart for the --drop option of (deb) gbp-pq. Signed-off-by: Markus Lehtonen --- docs/manpages/gbp-pq-rpm.xml | 10 ++++++++++ gbp/scripts/pq_rpm.py | 5 +++++ tests/component/rpm/test_pq_rpm.py | 8 +++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/manpages/gbp-pq-rpm.xml b/docs/manpages/gbp-pq-rpm.xml index a26c2b39..c06fb0ab 100644 --- a/docs/manpages/gbp-pq-rpm.xml +++ b/docs/manpages/gbp-pq-rpm.xml @@ -25,6 +25,7 @@ TAG-FORMAT num + @@ -179,6 +180,15 @@ + + + + + Whether to drop (delete) the patch queue branch after a succesful + export. + + + diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py index 7808e24b..fcefbb6e 100755 --- a/gbp/scripts/pq_rpm.py +++ b/gbp/scripts/pq_rpm.py @@ -204,6 +204,7 @@ def export_patches(repo, options): repo.set_branch(base) pq_branch = current else: + base = current pq_branch = pq_branch_name(current) spec = parse_spec(options, repo) upstream_commit = find_upstream_commit(repo, spec, options.upstream_tag) @@ -213,6 +214,9 @@ def export_patches(repo, options): GitCommand('status')(['--', spec.specdir]) + if options.drop: + drop_pq(repo, base) + def safe_patches(queue): """ @@ -390,6 +394,7 @@ def build_parser(name): parser.add_option("--force", dest="force", action="store_true", default=False, help="In case of import even import if the branch already exists") + parser.add_boolean_config_file_option("drop", dest='drop') parser.add_config_file_option(option_name="color", dest="color", type='tristate') parser.add_config_file_option(option_name="color-scheme", diff --git a/tests/component/rpm/test_pq_rpm.py b/tests/component/rpm/test_pq_rpm.py index 57f74d9f..16044fdc 100644 --- a/tests/component/rpm/test_pq_rpm.py +++ b/tests/component/rpm/test_pq_rpm.py @@ -113,9 +113,11 @@ class TestPqRpm(RpmRepoTestBase): self._check_repo_state(repo, 'patch-queue/master-orphan', branches, files) - # Test export - eq_(mock_pq(['export', '--upstream-tag', 'upstream/%(version)s', - '--spec-file', 'packaging/gbp-test2.spec']), 0) + # Test export with --drop + branches.remove('patch-queue/master-orphan') + eq_(mock_pq(['export', '--drop', '--upstream-tag', + 'upstream/%(version)s', '--spec-file', + 'packaging/gbp-test2.spec']), 0) self._check_repo_state(repo, 'master-orphan', branches, clean=False) eq_(repo.status()[' M'], [b'packaging/gbp-test2.spec']) self._has_patches('packaging/gbp-test2.spec', patches) -- cgit v1.2.3