/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/_readdir_py.py

  • Committer: Robert Collins
  • Date: 2010-05-06 23:41:35 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506234135-yivbzczw1sejxnxc
Lock methods on ``Tree``, ``Branch`` and ``Repository`` are now
expected to return an object which can be used to unlock them. This reduces
duplicate code when using cleanups. The previous 'tokens's returned by
``Branch.lock_write`` and ``Repository.lock_write`` are now attributes
on the result of the lock_write. ``repository.RepositoryWriteLockResult``
and ``branch.BranchWriteLockResult`` document this. (Robert Collins)

``log._get_info_for_log_files`` now takes an add_cleanup callable.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Python implementation of readdir interface."""
18
18
 
19
 
from __future__ import absolute_import
20
19
 
21
20
import stat
22
21
 
31
30
_unknown = 'unknown'
32
31
 
33
32
_formats = {
34
 
    stat.S_IFDIR: 'directory',
35
 
    stat.S_IFCHR: 'chardev',
36
 
    stat.S_IFBLK: 'block',
37
 
    stat.S_IFREG: 'file',
38
 
    stat.S_IFIFO: 'fifo',
39
 
    stat.S_IFLNK: 'symlink',
40
 
    stat.S_IFSOCK: 'socket',
 
33
    stat.S_IFDIR:'directory',
 
34
    stat.S_IFCHR:'chardev',
 
35
    stat.S_IFBLK:'block',
 
36
    stat.S_IFREG:'file',
 
37
    stat.S_IFIFO:'fifo',
 
38
    stat.S_IFLNK:'symlink',
 
39
    stat.S_IFSOCK:'socket',
41
40
}
42
41
 
43
42
 
47
46
    It's performance is critical: Do not mutate without careful benchmarking.
48
47
    """
49
48
    try:
50
 
        return _formats[stat_mode & 0o170000]
 
49
        return _formats[stat_mode & 0170000]
51
50
    except KeyError:
52
51
        return _unknown