~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/cleanup.py

  • Committer: Robert Collins
  • Date: 2010-02-01 22:22:28 UTC
  • mto: This revision was merged to the branch mainline in revision 4997.
  • Revision ID: robertc@robertcollins.net-20100201222228-qr97l7uuwn84zisn
Set the file mtime when exporting to a directory to prevent triggering make rebuilds unnecessarily.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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,