summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-04-09 16:48:45 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-11-14 14:47:20 +0200
commita72a5851333042646b6f1710c1681a78ce9447e3 (patch)
tree3b0414d33c9b30995390faf32e6a7dfa3380e4b2
parent1d0472085b99456731dbf11c3dd080e868525eb6 (diff)
downloadgit-buildpackage-a72a5851333042646b6f1710c1681a78ce9447e3.tar.gz
git-buildpackage-a72a5851333042646b6f1710c1681a78ce9447e3.tar.bz2
git-buildpackage-a72a5851333042646b6f1710c1681a78ce9447e3.zip
pq-rpm: don't create pq branch when switching
Pq branch must be created with 'import'. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rwxr-xr-xgbp/scripts/pq_rpm.py6
-rw-r--r--tests/component/rpm/test_pq_rpm.py18
2 files changed, 13 insertions, 11 deletions
diff --git a/gbp/scripts/pq_rpm.py b/gbp/scripts/pq_rpm.py
index d8fa88f8..6380ee22 100755
--- a/gbp/scripts/pq_rpm.py
+++ b/gbp/scripts/pq_rpm.py
@@ -473,11 +473,7 @@ def switch_to_pq_branch(repo, branch, options):
spec = parse_spec(options, repo, branch)
pq_branch = pq_branch_name(branch, options, spec.version)
if not repo.has_branch(pq_branch):
- upstream_commit = find_upstream_commit(repo, spec, options.upstream_tag)
- try:
- repo.create_branch(pq_branch, rev=upstream_commit)
- except GitRepositoryError as err:
- raise GbpError("Cannot create patch-queue branch: %s" % err)
+ raise GbpError("Branch '%s' does not exist" % pq_branch)
gbp.log.info("Switching to branch '%s'" % pq_branch)
repo.set_branch(pq_branch)
diff --git a/tests/component/rpm/test_pq_rpm.py b/tests/component/rpm/test_pq_rpm.py
index f016f1f3..ba6229d2 100644
--- a/tests/component/rpm/test_pq_rpm.py
+++ b/tests/component/rpm/test_pq_rpm.py
@@ -158,11 +158,16 @@ class TestPqRpm(RpmRepoTestBase):
repo = self.init_test_repo('gbp-test')
pkg_files = repo.list_files()
branches = repo.get_local_branches() + ['development/master']
- upstr_files = ['dummy.sh', 'Makefile', 'README']
- # Switch to pq branch
+ # Switch to non-existent pq-branch should fail
+ eq_(mock_pq(['switch']), 1)
+ self._check_log(-1, ".*Branch 'development/master' does not exist")
+
+ # Import and switch to base branch and back to pq
+ eq_(mock_pq(['import']), 0)
eq_(mock_pq(['switch']), 0)
- self._check_repo_state(repo, 'development/master', branches,
- upstr_files)
+ self._check_repo_state(repo, 'master', branches)
+ eq_(mock_pq(['switch']), 0)
+ self._check_repo_state(repo, 'development/master', branches)
# Switch back to packaging branch
eq_(mock_pq(['switch']), 0)
@@ -236,6 +241,9 @@ class TestPqRpm(RpmRepoTestBase):
eq_(mock_pq(['apply']), 1)
self._check_log(-1, "gbp:error: No patch name given.")
+ # Create a pristine pq-branch
+ repo.create_branch('development/master', 'upstream')
+
# Apply patch
with tempfile.NamedTemporaryFile() as tmp_patch:
tmp_patch.write(repo.show('master:%s' % 'my.patch'))
@@ -362,8 +370,6 @@ class TestPqRpm(RpmRepoTestBase):
# Invalid branch name
eq_(mock_pq(['import', '--pq-branch=foo:']), 1)
self._check_log(-1, "gbp:error: Cannot create patch-queue branch")
- eq_(mock_pq(['switch', '--pq-branch=foo:']), 1)
- self._check_log(-1, "gbp:error: Cannot create patch-queue branch")
# Try all possible keys in pq-branch format string
eq_(mock_pq(['import',