~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cleanup.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-03 09:04:38 UTC
  • mfrom: (4999.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100203090438-2qn9wus9kyyfyyek
(vila) Merge 2.1 to trunk,
        including fix for bug #515597 (per-file merge hook typo)

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(do_something)
 
34
    operation = OperationWithCleanups(lambda operation: do_something())
35
35
    operation.add_cleanup(cleanup_something)
36
 
    operation.run_simple()
 
36
    operation.run()
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,