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

Abstract out kind mapping a bit, initial work on support tree-references.

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
    blob._text = entry.symlink_target
205
205
    return blob
206
206
 
 
207
def mode_is_executable(mode):
 
208
    return bool(mode & 0111)
 
209
 
 
210
def mode_kind(mode):
 
211
    entry_kind = (mode & 0700000) / 0100000
 
212
    if entry_kind == 0:
 
213
        return 'directory'
 
214
    elif entry_kind == 1:
 
215
        file_kind = (mode & 070000) / 010000
 
216
        if file_kind == 0:
 
217
            return 'file'
 
218
        elif file_kind == 2:
 
219
            return 'symlink'
 
220
        elif file_kind == 6:
 
221
            return 'tree-reference'
 
222
        else:
 
223
            raise AssertionError(
 
224
                "Unknown file kind %d, perms=%o." % (file_kind, mode,))
 
225
    else:
 
226
        raise AssertionError(
 
227
            "Unknown kind, perms=%r." % (mode,))
 
228
 
207
229
 
208
230
def entry_mode(entry):
209
231
    if entry.kind == 'directory':