diff options
-rw-r--r-- | gbp/git/repository.py | 1 | ||||
-rw-r--r-- | gbp/scripts/common/pq.py | 22 | ||||
-rwxr-xr-x | gbp/scripts/pq.py | 5 | ||||
-rw-r--r-- | tests/01_test_help.py | 1 | ||||
-rw-r--r-- | tests/02_test_upstream_source_tar_unpack.py | 1 | ||||
-rw-r--r-- | tests/04_test_submodules.py | 1 | ||||
-rw-r--r-- | tests/07_test_fastimport.py | 2 | ||||
-rw-r--r-- | tests/08_test_patch.py | 2 | ||||
-rw-r--r-- | tests/09_test_write_tree.py | 2 | ||||
-rw-r--r-- | tests/10_test_get_upstream_tree.py | 2 |
10 files changed, 15 insertions, 24 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 3f6f5cb..4c087a8 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -16,7 +16,6 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """A Git repository""" -import re import subprocess import os.path from collections import defaultdict diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py index 8a6a06c..4d69c7f 100644 --- a/gbp/scripts/common/pq.py +++ b/gbp/scripts/common/pq.py @@ -22,11 +22,9 @@ import re import os import shutil import subprocess -from gbp.git import (GitRepositoryError, GitRepository) -from gbp.command_wrappers import (Command, GitCommand, RunAtCommand) +from gbp.git import GitRepositoryError from gbp.errors import GbpError import gbp.log -from gbp.patch_series import (PatchSeries, Patch) PQ_BRANCH_PREFIX = "patch-queue/" @@ -75,14 +73,13 @@ def write_patch(patch, patch_dir, options): tmpname = patch + ".gbp" old = file(patch, 'r') tmp = file(tmpname, 'w') - in_patch = False topic = None # Skip first line (From <sha1>) old.readline() for line in old: if line.lower().startswith("gbp-pq-topic: "): - topic = line.split(" ",1)[1].strip() + topic = line.split(" ", 1)[1].strip() gbp.log.debug("Topic %s found for %s" % (topic, patch)) continue tmp.write(line) @@ -114,7 +111,8 @@ def write_patch(patch, patch_dir, options): def get_maintainer_from_control(): """Get the maintainer from the control file""" cmd = 'sed -n -e \"s/Maintainer: \\+\\(.*\\)/\\1/p\" debian/control' - cmdout = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.readlines() + cmdout = subprocess.Popen(cmd, shell=True, + stdout=subprocess.PIPE).stdout.readlines() if len(cmdout) > 0: maintainer = cmdout[0].strip() @@ -130,7 +128,7 @@ def switch_to_pq_branch(repo, branch): Switch to patch-queue branch if not already there, create it if it doesn't exist yet """ - if is_pq_branch (branch): + if is_pq_branch(branch): return pq_branch = pq_branch_name(branch) @@ -138,8 +136,8 @@ def switch_to_pq_branch(repo, branch): try: repo.create_branch(pq_branch) except GitRepositoryError: - raise GbpError("Cannot create patch-queue branch '%s'. Try 'rebase' instead." - % pq_branch) + raise GbpError("Cannot create patch-queue branch '%s'. " + "Try 'rebase' instead." % pq_branch) gbp.log.info("Switching to '%s'" % pq_branch) repo.set_branch(pq_branch) @@ -152,9 +150,9 @@ def apply_single_patch(repo, branch, patch, topic=None): def apply_and_commit_patch(repo, patch, topic=None): """apply a single patch 'patch', add topic 'topic' and commit it""" - author = { 'name': patch.author, - 'email': patch.email, - 'date': patch.date } + author = {'name': patch.author, + 'email': patch.email, + 'date': patch.date } if not (patch.author and patch.email): name, email = get_maintainer_from_control() diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py index ed95e0f..0118c27 100755 --- a/gbp/scripts/pq.py +++ b/gbp/scripts/pq.py @@ -22,10 +22,9 @@ import os import shutil import sys import tempfile -from gbp.config import (GbpOptionParserDebian, GbpOptionGroup) +from gbp.config import GbpOptionParserDebian from gbp.git import (GitRepositoryError, GitRepository) -from gbp.command_wrappers import (Command, GitCommand, RunAtCommand, - CommandExecFailed) +from gbp.command_wrappers import (GitCommand, CommandExecFailed) from gbp.errors import GbpError import gbp.log from gbp.patch_series import (PatchSeries, Patch) diff --git a/tests/01_test_help.py b/tests/01_test_help.py index e30bc45..3077c7d 100644 --- a/tests/01_test_help.py +++ b/tests/01_test_help.py @@ -2,7 +2,6 @@ """Check if --help works""" -import os import unittest class TestHelp(unittest.TestCase): diff --git a/tests/02_test_upstream_source_tar_unpack.py b/tests/02_test_upstream_source_tar_unpack.py index f77f374..650dc2a 100644 --- a/tests/02_test_upstream_source_tar_unpack.py +++ b/tests/02_test_upstream_source_tar_unpack.py @@ -2,7 +2,6 @@ """Test L{UpstreamSource}'s tarball unpack""" -import glob import os import shutil import tarfile diff --git a/tests/04_test_submodules.py b/tests/04_test_submodules.py index 5ae1f5f..f40bc4d 100644 --- a/tests/04_test_submodules.py +++ b/tests/04_test_submodules.py @@ -5,7 +5,6 @@ import os import shutil import tarfile -import tempfile import gbp.log import gbp.git diff --git a/tests/07_test_fastimport.py b/tests/07_test_fastimport.py index 7e38bf2..a23cd64 100644 --- a/tests/07_test_fastimport.py +++ b/tests/07_test_fastimport.py @@ -4,8 +4,6 @@ import os import shutil -import tarfile -import tempfile import gbp.log import gbp.git diff --git a/tests/08_test_patch.py b/tests/08_test_patch.py index 92a6739..7aa6048 100644 --- a/tests/08_test_patch.py +++ b/tests/08_test_patch.py @@ -7,6 +7,7 @@ import unittest from gbp.patch_series import Patch + class TestPatch(unittest.TestCase): data_dir = "tests/%s_data" % __module__ @@ -35,4 +36,3 @@ class TestPatch(unittest.TestCase): "It can span several lines.\n", p.long_desc) self.assertEqual('Sat, 24 Dec 2011 12:05:53 +0100', p.date) - diff --git a/tests/09_test_write_tree.py b/tests/09_test_write_tree.py index d721ce6..dd81f70 100644 --- a/tests/09_test_write_tree.py +++ b/tests/09_test_write_tree.py @@ -58,7 +58,7 @@ class TestWriteTree(testutils.DebianGitTestRepo): ) self.assertEqual(len(commit), 40) # commit the same tree again using the previous commit as parent - commit2 = self.repo.commit_tree(sha1, "second commit", parents=[commit]) + self.repo.commit_tree(sha1, "second commit", parents=[commit]) # commit the same tree again using a non existant parent self.assertRaises(gbp.errors.GbpError, self.repo.commit_tree, diff --git a/tests/10_test_get_upstream_tree.py b/tests/10_test_get_upstream_tree.py index 3cd7eb8..8c60178 100644 --- a/tests/10_test_get_upstream_tree.py +++ b/tests/10_test_get_upstream_tree.py @@ -58,7 +58,7 @@ class TestGetUpstreamTree(testutils.DebianGitTestRepo): def test_valid_tag(self): """Write out index file to nonexistant dir""" self.add_file('foo') - tree = self.repo.rev_parse('master') + self.repo.rev_parse('master') cp = { 'Upstream-Version': '1.0~rc3' } self.repo.create_tag('upstream/1.0_rc3') options = MockOptions(upstream_tree="TAG", |