Merge lp:~abentley/bzr/fix-terminal-spew into lp:bzr
Status: | Merged |
---|---|
Merged at revision: | 5310 |
Proposed branch: | lp:~abentley/bzr/fix-terminal-spew |
Merge into: | lp:bzr |
Diff against target: |
80 lines (+21/-7) 4 files modified
NEWS (+2/-0) bzr (+6/-3) bzrlib/__init__.py (+7/-4) bzrlib/ui/text.py (+6/-0) |
To merge this branch: | bzr merge lp:~abentley/bzr/fix-terminal-spew |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Needs Fixing | ||
Andrew Bennetts | Needs Fixing | ||
Review via email: mp+25233@code.launchpad.net |
Commit message
Clean up progress output on exit.
Description of the change
Hi all,
This branch introduces automatic cleanup for progress output when exiting.
It accomplishes this by introducing bzrlib.clean_up, which indirectly calls
clear_term.
TextUIFactory is converted into a Context Manager, and bzrlib.clean_up will
invoke __exit__ on the ui factory, if it provides it.
Why a Context Manager, since Python 2.4 doesn't support the with statement?
Because this is a common idiom in the Python world for managing resources which
may perform actions when acquired and released, and because some bzrlib clients
are using more recent Pythons.
It turned out we were setting up a bunch of atexit entries in
bzrlib.initialize, but these are actually meant to run when bzrlib is no longer
being used, so they were moved to bzrlib.clean_up.
Seems nice to me.