/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Andrew Bennetts
  • Date: 2008-02-18 08:30:38 UTC
  • mto: This revision was merged to the branch mainline in revision 3756.
  • Revision ID: andrew.bennetts@canonical.com-20080218083038-tts55zsx5xrz3l2e
Lots of assorted hackery to reduce the number of imports for common operations.  Improves 'rocks', 'st' and 'help' times by ~50ms on my laptop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
from cStringIO import StringIO
18
17
import os
19
18
import re
20
19
import stat
59
58
    deprecated_function,
60
59
    one_zero,
61
60
    )
62
 
from bzrlib.trace import mutter
63
61
 
64
62
 
65
63
# On win32, O_BINARY is used to indicate the file should
286
284
 
287
285
 
288
286
def _win32_abspath(path):
 
287
    global _win32_abspath
 
288
    if win32utils.winver == 'Windows 98':
 
289
        _win32_abspath = _win98_abspath
 
290
    else:
 
291
        _win32_abspath = _real_win32_abspath
 
292
    return _win32_abspath(path)
 
293
 
 
294
 
 
295
def _real_win32_abspath(path):
289
296
    # Real _nt_abspath doesn't have a problem with a unicode cwd
290
297
    return _win32_fixdrive(_nt_abspath(unicode(path)).replace('\\', '/'))
291
298
 
316
323
        path = cwd + '\\' + path
317
324
    return _win32_fixdrive(_nt_normpath(path).replace('\\', '/'))
318
325
 
319
 
if win32utils.winver == 'Windows 98':
320
 
    _win32_abspath = _win98_abspath
321
 
 
322
326
 
323
327
def _win32_realpath(path):
324
328
    # Real _nt_realpath doesn't have a problem with a unicode cwd
426
430
    On my standard US Windows XP, the preferred encoding is
427
431
    cp1252, but the console is cp437
428
432
    """
 
433
    from bzrlib.trace import mutter
429
434
    output_encoding = getattr(sys.stdout, 'encoding', None)
430
435
    if not output_encoding:
431
436
        input_encoding = getattr(sys.stdin, 'encoding', None)