/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/launchpad/lp_propose.py

Use new context stuff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
        for rdata in self.reviews:
104
104
            uniquename = "%s (%s)" % (rdata[0].display_name, rdata[0].name)
105
105
            info.append('Reviewer: %s, type "%s"\n' % (uniquename, rdata[1]))
106
 
        self.source_branch.bzr.lock_read()
107
 
        try:
108
 
            self.target_branch.bzr.lock_read()
109
 
            try:
110
 
                body = self.get_initial_body()
111
 
            finally:
112
 
                self.target_branch.bzr.unlock()
113
 
        finally:
114
 
            self.source_branch.bzr.unlock()
 
106
        with self.source_branch.bzr.lock_read(), \
 
107
                self.target_branch.bzr.lock_read():
 
108
            body = self.get_initial_body()
115
109
        initial_comment = msgeditor.edit_commit_message(''.join(info),
116
110
                                                        start_message=body)
117
111
        return initial_comment.strip().encode('utf-8')
142
136
    def get_source_revid(self):
143
137
        """Get the revision ID of the source branch."""
144
138
        source_branch = self.source_branch.bzr
145
 
        source_branch.lock_read()
146
 
        try:
 
139
        with source_branch.lock_read():
147
140
            return source_branch.last_revision()
148
 
        finally:
149
 
            source_branch.unlock()
150
141
 
151
142
    def check_proposal(self):
152
143
        """Check that the submission is sensible."""