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
1=== modified file 'cmds.py'
2--- cmds.py 2010-05-04 11:27:46 +0000
3+++ cmds.py 2010-05-05 07:29:21 +0000
4@@ -22,10 +22,6 @@
5 #
6
7 import commands
8-try:
9- import hashlib as md5
10-except ImportError:
11- import md5
12 import os
13 import shutil
14 import subprocess
15@@ -48,7 +44,6 @@
16 )
17 from bzrlib.option import Option
18 from bzrlib.revisionspec import RevisionSpec
19-from bzrlib import revision as mod_revision
20 from bzrlib.tag import _merge_tags_if_possible
21 from bzrlib.trace import note, warning
22 from bzrlib.workingtree import WorkingTree
23@@ -967,11 +962,10 @@
24 takes_args = ['source']
25
26 def run(self, source):
27- source_branch = target_branch = None
28+ source_branch = None
29 # Get the target branch.
30 try:
31 tree = WorkingTree.open_containing('.')[0]
32- target_branch = tree.branch
33 except (NotBranchError, NoWorkingTree):
34 raise BzrCommandError(
35 "There is no tree to merge the source branch in to")
36@@ -982,28 +976,24 @@
37 raise BzrCommandError("Invalid source branch URL?")
38
39 tree.lock_write()
40- try:
41- this_config = debuild_config(tree, tree, False)
42- source_branch.lock_read()
43- try:
44- that_config = debuild_config(source_branch.basis_tree(),
45- source_branch.basis_tree(), False)
46- if not (this_config.native or that_config.native):
47- fix_ancestry_as_needed(tree, source_branch)
48+ self.add_cleanup(tree.unlock)
49+ source_branch.lock_read()
50+ self.add_cleanup(source_branch.unlock)
51+ this_config = debuild_config(tree, tree, False)
52+ that_config = debuild_config(source_branch.basis_tree(),
53+ source_branch.basis_tree(), False)
54+ if not (this_config.native or that_config.native):
55+ fix_ancestry_as_needed(tree, source_branch)
56
57- # Merge source packaging branch in to the target packaging branch.
58- _merge_tags_if_possible(source_branch, tree.branch)
59- conflicts = tree.merge_from_branch(source_branch)
60- if conflicts > 0:
61- note('The merge resulted in %s conflicts. Please resolve these '
62- 'and commit the changes with "bzr commit".' % conflicts)
63- else:
64- note('The merge resulted in no conflicts. You may commit the '
65- 'changes by running "bzr commit".')
66- finally:
67- source_branch.unlock()
68- finally:
69- tree.unlock()
70+ # Merge source packaging branch in to the target packaging branch.
71+ _merge_tags_if_possible(source_branch, tree.branch)
72+ conflicts = tree.merge_from_branch(source_branch)
73+ if conflicts > 0:
74+ note('The merge resulted in %s conflicts. Please resolve these '
75+ 'and commit the changes with "bzr commit".' % conflicts)
76+ else:
77+ note('The merge resulted in no conflicts. You may commit the '
78+ 'changes by running "bzr commit".')
79
80
81 class cmd_dh_make(Command):
82
83=== modified file 'dh_make.py'
84--- dh_make.py 2010-05-03 03:03:34 +0000
85+++ dh_make.py 2010-05-05 07:29:21 +0000
86@@ -1,9 +1,4 @@
87-try:
88- import hashlib as md5
89-except ImportError:
90- import md5
91 import os
92-import shutil
93 import sys
94 import subprocess
95
96
97=== modified file 'import_dsc.py'
98--- import_dsc.py 2010-05-04 06:51:23 +0000
99+++ import_dsc.py 2010-05-05 07:29:21 +0000
100@@ -30,10 +30,6 @@
101 standard_b64encode,
102 )
103 import errno
104-try:
105- import hashlib as md5
106-except ImportError:
107- import md5
108 import os
109 import re
110 import shutil

Subscribers

People subscribed via source and target branches