summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-09-12 13:05:47 +0200
committerJun Wang <junbill.wang@samsung.com>2016-01-27 00:05:52 +0800
commit4e6bcb7dcd6ea1960af9ba77c0d25740c57d6de1 (patch)
treec94131b0bf23854fa5385630ad45824b4f3e1abd
parent1a36150b82dda766d4a1bbd4d2b277de01728a72 (diff)
downloadgit-buildpackage-4e6bcb7dcd6ea1960af9ba77c0d25740c57d6de1.tar.gz
git-buildpackage-4e6bcb7dcd6ea1960af9ba77c0d25740c57d6de1.tar.bz2
git-buildpackage-4e6bcb7dcd6ea1960af9ba77c0d25740c57d6de1.zip
Allow to always drop pq branch after export
Closes: #761160 Conflicts: gbp/config.py
-rw-r--r--gbp/config.py4
-rwxr-xr-xgbp/scripts/pq.py4
-rw-r--r--tests/13_test_gbp_pq.py23
3 files changed, 30 insertions, 1 deletions
diff --git a/gbp/config.py b/gbp/config.py
index 0b6c3b24..0c9f885c 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -161,6 +161,7 @@ class GbpOptionParser(OptionParser):
'symlink-orig': 'True',
'purge': 'True',
'tmp-dir' : '/var/tmp/gbp/',
+ 'drop': 'False',
}
help = {
'debian-branch':
@@ -309,6 +310,9 @@ class GbpOptionParser(OptionParser):
'tmp-dir':
("Base directory under which temporary directories are "
"created, default is '%(tmp-dir)s'"),
+ 'drop':
+ ("In case of 'export' drop the patch-queue branch "
+ "after export. Default is '%(drop)s'"),
}
def_config_files = [ '/etc/git-buildpackage/gbp.conf',
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index 2445c70e..5f899b81 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -117,6 +117,9 @@ def export_patches(repo, branch, options):
else:
gbp.log.info("No patches on '%s' - nothing to do." % pq_branch)
+ if options.drop:
+ drop_pq(repo, branch)
+
def safe_patches(series, tmpdir_base):
"""
@@ -257,6 +260,7 @@ def build_parser(name):
help="verbose command execution")
parser.add_option("--topic", dest="topic", help="in case of 'apply' topic (subdir) to put patch into")
parser.add_config_file_option(option_name="time-machine", dest="time_machine", type="int")
+ parser.add_boolean_config_file_option("drop", dest='drop')
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_config_file_option(option_name="color", dest="color", type='tristate')
diff --git a/tests/13_test_gbp_pq.py b/tests/13_test_gbp_pq.py
index 0b400c21..87bcd796 100644
--- a/tests/13_test_gbp_pq.py
+++ b/tests/13_test_gbp_pq.py
@@ -25,7 +25,7 @@ try:
except ImportError:
import unittest
-from gbp.scripts.pq import generate_patches
+from gbp.scripts.pq import generate_patches, switch_pq, export_patches
import gbp.scripts.common.pq as pq
import gbp.patch_series
import tests.testutils as testutils
@@ -137,5 +137,26 @@ class TestWritePatch(testutils.DebianGitTestRepo):
# Branches must be identical afterwards
self.assertEqual('', diff)
+class TestExport(testutils.DebianGitTestRepo):
+ class Options(object):
+ drop = True
+ patch_numbers = False
+
+ def setUp(self):
+ testutils.DebianGitTestRepo.setUp(self)
+ self.add_file('bar', 'bar')
+
+ def test_drop(self):
+ """Test if we drop the patch-queue branch with --drop"""
+ repo = self.repo
+ start = repo.get_branch()
+ pq = os.path.join('patch-queue', start)
+ switch_pq(repo, start)
+ self.assertEqual(repo.get_branch(), pq)
+ export_patches(repo, pq, TestExport.Options)
+ self.assertEqual(repo.get_branch(), start)
+ self.assertFalse(repo.has_branch(pq))
+
+
def _patch_path(name):
return os.path.join(context.projectdir, 'tests/data', name)