/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: 2006-11-21 08:16:46 UTC
  • mfrom: (2145 +trunk)
  • mto: (2018.8.1 split smart)
  • mto: This revision was merged to the branch mainline in revision 2435.
  • Revision ID: andrew.bennetts@canonical.com-20061121081646-ef6a49ad44bf2f9b
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Bazaar -- distributed version control
2
 
#
3
 
# Copyright (C) 2005 Canonical Ltd
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
4
2
#
5
3
# This program is free software; you can redistribute it and/or modify
6
4
# it under the terms of the GNU General Public License as published by
334
332
        """Error handler for shutil.rmtree function [for win32]
335
333
        Helps to remove files and dirs marked as read-only.
336
334
        """
337
 
        type_, value = excinfo[:2]
 
335
        exception = excinfo[1]
338
336
        if function in (os.remove, os.rmdir) \
339
 
            and type_ == OSError \
340
 
            and value.errno == errno.EACCES:
 
337
            and isinstance(exception, OSError) \
 
338
            and exception.errno == errno.EACCES:
341
339
            make_writable(path)
342
340
            function(path)
343
341
        else:
374
372
            mutter('encoding stdout as sys.stdin encoding %r', output_encoding)
375
373
    else:
376
374
        mutter('encoding stdout as sys.stdout encoding %r', output_encoding)
 
375
    if output_encoding == 'cp0':
 
376
        # invalid encoding (cp0 means 'no codepage' on Windows)
 
377
        output_encoding = bzrlib.user_encoding
 
378
        mutter('cp0 is invalid encoding.'
 
379
               ' encoding stdout as bzrlib.user_encoding %r', output_encoding)
377
380
    return output_encoding
378
381
 
379
382
 
1087
1090
                         "  Continuing with ascii encoding.\n"
1088
1091
                         % (e, os.environ.get('LANG')))
1089
1092
 
1090
 
    if _cached_user_encoding is None:
 
1093
    # Windows returns 'cp0' to indicate there is no code page. So we'll just
 
1094
    # treat that as ASCII, and not support printing unicode characters to the
 
1095
    # console.
 
1096
    if _cached_user_encoding in (None, 'cp0'):
1091
1097
        _cached_user_encoding = 'ascii'
1092
1098
    return _cached_user_encoding
1093
1099