aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2015-03-05 08:55:28 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2018-01-17 12:33:10 +0200
commitc8dbfe1281926b45000360727e94d71f9a56deb0 (patch)
tree202c7b90b343e225ce5fce66ceb548a3fc16ee08
parentc782a29c452eb68bd49951fc8180c907793ae53f (diff)
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 <markus.lehtonen@linux.intel.com>
-rw-r--r--docs/manpages/gbp-pq-rpm.xml10
-rwxr-xr-xgbp/scripts/pq_rpm.py5
-rw-r--r--tests/component/rpm/test_pq_rpm.py8
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 @@
<arg><option>--upstream-tag=</option><replaceable>TAG-FORMAT</replaceable></arg>
<arg><option>--abbrev=</option><replaceable>num</replaceable></arg>
<arg><option>--force</option></arg>
+ <arg><option>--[no-]drop</option></arg>
<arg><option>--[no-]patch-numbers</option></arg>
<group choice="plain">
<arg><option>drop</option></arg>
@@ -180,6 +181,15 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--[no-]drop</option></term>
+ <listitem>
+ <para>
+ Whether to drop (delete) the patch queue branch after a succesful
+ export.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>--[no-]patch-numbers</option>
</term>
<listitem>
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)