~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/dir_exporter.py

merge hpss-get-checkout-format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    # Note in the case of revision trees, this does trigger a double inventory
53
53
    # lookup, hopefully it isn't too expensive.
54
54
    to_fetch = []
55
 
    for dp, ie in _export_iter_entries(tree, subdir):
 
55
    for dp, tp, ie in _export_iter_entries(tree, subdir):
56
56
        fullpath = osutils.pathjoin(dest, dp)
57
57
        if ie.kind == "file":
58
 
            to_fetch.append((ie.file_id, (dp, tree.is_executable(ie.file_id))))
 
58
            to_fetch.append((ie.file_id, (dp, tp, ie.file_id)))
59
59
        elif ie.kind == "directory":
60
60
            os.mkdir(fullpath)
61
61
        elif ie.kind == "symlink":
62
62
            try:
63
 
                symlink_target = tree.get_symlink_target(ie.file_id)
 
63
                symlink_target = tree.get_symlink_target(ie.file_id, tp)
64
64
                os.symlink(symlink_target, fullpath)
65
65
            except OSError, e:
66
66
                raise errors.BzrError(
74
74
    # The data returned here can be in any order, but we've already created all
75
75
    # the directories
76
76
    flags = os.O_CREAT | os.O_TRUNC | os.O_WRONLY | getattr(os, 'O_BINARY', 0)
77
 
    for (relpath, executable), chunks in tree.iter_files_bytes(to_fetch):
 
77
    for (relpath, treepath, file_id), chunks in tree.iter_files_bytes(to_fetch):
78
78
        fullpath = osutils.pathjoin(dest, relpath)
79
79
        # We set the mode and let the umask sort out the file info
80
80
        mode = 0666
81
 
        if executable:
 
81
        if tree.is_executable(file_id, treepath):
82
82
            mode = 0777
83
83
        out = os.fdopen(os.open(fullpath, flags, mode), 'wb')
84
84
        try:
88
88
        if force_mtime is not None:
89
89
            mtime = force_mtime
90
90
        else:
91
 
            if subdir is None:
92
 
                file_id = tree.path2id(relpath)
93
 
            else:
94
 
                file_id = tree.path2id(osutils.pathjoin(subdir, relpath))
95
 
            mtime = tree.get_file_mtime(file_id, relpath)
 
91
            mtime = tree.get_file_mtime(file_id, treepath)
96
92
        os.utime(fullpath, (mtime, mtime))
97
93
 
98
94
        yield