diff options
author | Guido Günther <agx@sigxcpu.org> | 2017-03-14 08:33:34 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2017-03-14 08:35:17 +0100 |
commit | 1dd290a792d5a9e3b712ff88482540fd283f0171 (patch) | |
tree | 499dd8df509101e1fb08ef3d2b40087e183decae /tests/13_test_gbp_pq.py | |
parent | fe821e2bec0df8611c2d0639a52baa8ddc84cc28 (diff) |
pq: unbreak --commit when patch series becomes empty
We skipped the commit when the patch series became completely empty
but we want to commit that change too.
Diffstat (limited to 'tests/13_test_gbp_pq.py')
-rw-r--r-- | tests/13_test_gbp_pq.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/13_test_gbp_pq.py b/tests/13_test_gbp_pq.py index c63ee12d..bb2206c6 100644 --- a/tests/13_test_gbp_pq.py +++ b/tests/13_test_gbp_pq.py @@ -217,6 +217,7 @@ class TestExport(testutils.DebianGitTestRepo): meta_closes = False meta_closes_bugnum = '' pq_from = 'DEBIAN' + commit = False def setUp(self): testutils.DebianGitTestRepo.setUp(self) @@ -257,6 +258,31 @@ class TestExport(testutils.DebianGitTestRepo): self.assertEqual(len(repo.get_commits()), 2, "Export must not create another commit") + def test_commit_dropped_patches(self): + """Test if we commit the patch-queue branch with all patches dropped""" + repo = self.repo + start = repo.get_branch() + pq_branch = os.path.join('patch-queue', start) + opts = TestExport.Options() + opts.commit = True + patch_dir = os.path.join(repo.path, 'debian/patches') + os.makedirs(patch_dir) + with open(os.path.join(patch_dir, 'series'), 'w') as f: + f.write("patch1.diff\n") + f.write("patch2.diff\n") + repo.add_files('debian/patches') + repo.commit_all('Add series file') + pq.switch_pq(repo, start) + self.assertEqual(len(repo.get_commits()), 2) + self.assertEqual(repo.get_branch(), pq_branch) + export_patches(repo, pq_branch, opts) + self.assertEqual(repo.get_branch(), start) + self.assertTrue(repo.has_branch(pq_branch)) + self.assertEqual(len(repo.get_commits()), 3, + "Export did not create commit") + self.assertIn("Dropped patch1.diff:", repo.show('HEAD')) + self.assertIn("Dropped patch2.diff:", repo.show('HEAD')) + class TestParseGbpCommand(unittest.TestCase): def test_empty_body(self): |