Merge lp:~spiv/bzr-builddeb/pyflakes-nits into lp:bzr-builddeb

Proposed by Andrew Bennetts
Status: Merged
Merged at revision: 449
Proposed branch: lp:~spiv/bzr-builddeb/pyflakes-nits
Merge into: lp:bzr-builddeb
Diff against target: 110 lines (+18/-37)
3 files modified
cmds.py (+18/-28)
dh_make.py (+0/-5)
import_dsc.py (+0/-4)
To merge this branch: bzr merge lp:~spiv/bzr-builddeb/pyflakes-nits
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+24726@code.launchpad.net

Description of the change

This is just some trivial tidying up with trivial benefit :)

Mainly it removes some unused imports reported by pyflakes.

It also simplifies some of the code in cmd_import_upstream by replacing nested try/finally blocks with add_cleanup calls.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'cmds.py'
--- cmds.py 2010-05-04 11:27:46 +0000
+++ cmds.py 2010-05-05 07:29:21 +0000
@@ -22,10 +22,6 @@
22#22#
2323
24import commands24import commands
25try:
26 import hashlib as md5
27except ImportError:
28 import md5
29import os25import os
30import shutil26import shutil
31import subprocess27import subprocess
@@ -48,7 +44,6 @@
48 )44 )
49from bzrlib.option import Option45from bzrlib.option import Option
50from bzrlib.revisionspec import RevisionSpec46from bzrlib.revisionspec import RevisionSpec
51from bzrlib import revision as mod_revision
52from bzrlib.tag import _merge_tags_if_possible47from bzrlib.tag import _merge_tags_if_possible
53from bzrlib.trace import note, warning48from bzrlib.trace import note, warning
54from bzrlib.workingtree import WorkingTree49from bzrlib.workingtree import WorkingTree
@@ -967,11 +962,10 @@
967 takes_args = ['source']962 takes_args = ['source']
968963
969 def run(self, source):964 def run(self, source):
970 source_branch = target_branch = None965 source_branch = None
971 # Get the target branch.966 # Get the target branch.
972 try:967 try:
973 tree = WorkingTree.open_containing('.')[0]968 tree = WorkingTree.open_containing('.')[0]
974 target_branch = tree.branch
975 except (NotBranchError, NoWorkingTree):969 except (NotBranchError, NoWorkingTree):
976 raise BzrCommandError(970 raise BzrCommandError(
977 "There is no tree to merge the source branch in to")971 "There is no tree to merge the source branch in to")
@@ -982,28 +976,24 @@
982 raise BzrCommandError("Invalid source branch URL?")976 raise BzrCommandError("Invalid source branch URL?")
983977
984 tree.lock_write()978 tree.lock_write()
985 try:979 self.add_cleanup(tree.unlock)
986 this_config = debuild_config(tree, tree, False)980 source_branch.lock_read()
987 source_branch.lock_read()981 self.add_cleanup(source_branch.unlock)
988 try:982 this_config = debuild_config(tree, tree, False)
989 that_config = debuild_config(source_branch.basis_tree(),983 that_config = debuild_config(source_branch.basis_tree(),
990 source_branch.basis_tree(), False)984 source_branch.basis_tree(), False)
991 if not (this_config.native or that_config.native):985 if not (this_config.native or that_config.native):
992 fix_ancestry_as_needed(tree, source_branch)986 fix_ancestry_as_needed(tree, source_branch)
993987
994 # Merge source packaging branch in to the target packaging branch.988 # Merge source packaging branch in to the target packaging branch.
995 _merge_tags_if_possible(source_branch, tree.branch)989 _merge_tags_if_possible(source_branch, tree.branch)
996 conflicts = tree.merge_from_branch(source_branch)990 conflicts = tree.merge_from_branch(source_branch)
997 if conflicts > 0:991 if conflicts > 0:
998 note('The merge resulted in %s conflicts. Please resolve these '992 note('The merge resulted in %s conflicts. Please resolve these '
999 'and commit the changes with "bzr commit".' % conflicts)993 'and commit the changes with "bzr commit".' % conflicts)
1000 else:994 else:
1001 note('The merge resulted in no conflicts. You may commit the '995 note('The merge resulted in no conflicts. You may commit the '
1002 'changes by running "bzr commit".')996 'changes by running "bzr commit".')
1003 finally:
1004 source_branch.unlock()
1005 finally:
1006 tree.unlock()
1007997
1008998
1009class cmd_dh_make(Command):999class cmd_dh_make(Command):
10101000
=== modified file 'dh_make.py'
--- dh_make.py 2010-05-03 03:03:34 +0000
+++ dh_make.py 2010-05-05 07:29:21 +0000
@@ -1,9 +1,4 @@
1try:
2 import hashlib as md5
3except ImportError:
4 import md5
5import os1import os
6import shutil
7import sys2import sys
8import subprocess3import subprocess
94
105
=== modified file 'import_dsc.py'
--- import_dsc.py 2010-05-04 06:51:23 +0000
+++ import_dsc.py 2010-05-05 07:29:21 +0000
@@ -30,10 +30,6 @@
30 standard_b64encode,30 standard_b64encode,
31 )31 )
32import errno32import errno
33try:
34 import hashlib as md5
35except ImportError:
36 import md5
37import os33import os
38import re34import re
39import shutil35import shutil

Subscribers

People subscribed via source and target branches