/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/send.py

  • Committer: Jelmer Vernooij
  • Date: 2019-08-11 13:21:03 UTC
  • mfrom: (7379 work)
  • mto: This revision was merged to the branch mainline in revision 7388.
  • Revision ID: jelmer@jelmer.uk-20190811132103-u3ne03yf37c1h57n
merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
        from_, possible_transports=possible_transports)[:2]
47
47
    # we may need to write data into branch's repository to calculate
48
48
    # the data to send.
49
 
    branch.lock_write()
50
 
    try:
 
49
    with branch.lock_write():
51
50
        if output is None:
52
51
            config_stack = branch.get_config_stack()
53
52
            if mail_to is None:
143
142
                    os.mkdir(output, 0o755)
144
143
                for (filename, lines) in directive.to_files():
145
144
                    path = os.path.join(output, filename)
146
 
                    outfile = open(path, 'wb')
147
 
                    try:
 
145
                    with open(path, 'wb') as outfile:
148
146
                        outfile.writelines(lines)
149
 
                    finally:
150
 
                        outfile.close()
151
147
            else:
152
148
                if output == '-':
153
149
                    outfile = to_file
158
154
                finally:
159
155
                    if outfile is not to_file:
160
156
                        outfile.close()
161
 
    finally:
162
 
        branch.unlock()
163
157
 
164
158
 
165
159
def _send_4(branch, revision_id, target_branch, public_branch,