Merge lp:~jelmer/bzr/no-termios into lp:bzr
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | Martin Packman |
Approved revision: | no longer in the source branch. |
Merged at revision: | 6380 |
Proposed branch: | lp:~jelmer/bzr/no-termios |
Merge into: | lp:bzr |
Diff against target: |
40 lines (+7/-3) 2 files modified
bzrlib/osutils.py (+3/-3) bzrlib/tests/test_import_tariff.py (+4/-0) |
To merge this branch: | bzr merge lp:~jelmer/bzr/no-termios |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Martin Packman (community) | Approve | ||
Review via email: mp+86166@code.launchpad.net |
Commit message
Avoid always importing termios and tty in bzrlib.osutils.
Description of the change
Lazily import tty and termios if we don't have to.
We only seem to use getchar() to get user input ("y", "n"), so it seems
reasonable to me to have a local import here. We could also make it
use lazy_import.
To post a comment you must log in.
Worth not importing these straight off.
The way imports are delayed in osutils is so inconsistent. This method is fine as we're not worried about getchar overhead, putting them in lazy import at the top may be slightly better, but less clear.
Arguably these functions should be made private, on trunk this needs to go through ui._ChooseUI or we break non-terminal interactions.