summaryrefslogtreecommitdiff
path: root/tests/13_test_gbp_pq.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-05-02 12:57:10 +0300
committerGuido Günther <agx@sigxcpu.org>2013-10-31 19:17:20 +0100
commitc661c7153783c79c45fbe63d828b03ea0a788215 (patch)
treefd2190d631e47c1f8d9b99f4949da237392eaacc /tests/13_test_gbp_pq.py
parent3092623a8841a6aa9e12902436779c8dea80598c (diff)
downloadgit-buildpackage-c661c7153783c79c45fbe63d828b03ea0a788215.tar.gz
git-buildpackage-c661c7153783c79c45fbe63d828b03ea0a788215.tar.bz2
git-buildpackage-c661c7153783c79c45fbe63d828b03ea0a788215.zip
pq: rewrite patch export functionality
Use our own function for constructing the patch files instead of using the format-patch command of git. This way, we get the desired output format directly, without the need for the error-prone "format-patch, parse patch files, mangle and re-write patch files" cycle. Also, fix patch naming in patch generation when '--no-patch-numbers' is used. Previously, multiple commits with the same subject resulted in multiple patches having the same filename. This lead into broken series with missing patches as patch files were overwritten by the topmost commit. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests/13_test_gbp_pq.py')
-rw-r--r--tests/13_test_gbp_pq.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/13_test_gbp_pq.py b/tests/13_test_gbp_pq.py
index cebea253..753143d3 100644
--- a/tests/13_test_gbp_pq.py
+++ b/tests/13_test_gbp_pq.py
@@ -21,6 +21,7 @@ import os
import logging
import unittest
+from gbp.scripts.pq import generate_patches
import gbp.scripts.common.pq as pq
import gbp.patch_series
import tests.testutils as testutils
@@ -103,8 +104,8 @@ class TestWritePatch(testutils.DebianGitTestRepo):
def tearDown(self):
context.teardown()
- def test_write_patch(self):
- """Test moving a patch to it's final location"""
+ def test_generate_patches(self):
+ """Test generation of patches"""
class opts: patch_numbers = False
@@ -115,13 +116,9 @@ class TestWritePatch(testutils.DebianGitTestRepo):
# Write it out as patch and check it's existence
d = context.new_tmpdir(__name__)
- patchfile = self.repo.format_patches('HEAD^', 'HEAD', str(d))[0]
- expected = os.path.join(str(d), '0001-added-foo.patch')
- self.assertEqual(expected, patchfile)
- pq.write_patch(patchfile, self.repo.path, opts)
- expected = os.path.join(self.repo.path,
- 'gbptest',
- 'added-foo.patch')
+ patchfile = generate_patches(self.repo, 'HEAD^', 'HEAD', str(d),
+ opts)[0]
+ expected = os.path.join(str(d), 'gbptest', 'added-foo.patch')
self.assertTrue(os.path.exists(expected))
logging.debug(file(expected).read())