~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cleanup.py

(andrew) Replace several fragile try/finally blocks in merge.py using
        bzrlib.cleanup. (#517275)

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
If you want to be certain that the first, and only the first, error is raised,
32
32
then use::
33
33
 
34
 
    operation = OperationWithCleanups(lambda operation: do_something())
 
34
    operation = OperationWithCleanups(do_something)
35
35
    operation.add_cleanup(cleanup_something)
36
 
    operation.run()
 
36
    operation.run_simple()
37
37
 
38
38
This is more inconvenient (because you need to make every try block a
39
39
function), but will ensure that the first error encountered is the one raised,