~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export/dir_exporter.py

Move all features to bzrlib.tests.features in 2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2008, 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
33
33
 
34
34
    `dest` should either not exist or should be empty. If it does not exist it
35
35
    will be created holding the contents of this tree.
36
 
    
 
36
 
37
37
    :param fileobj: Is not used in this exporter
38
38
 
39
39
    :note: If the export fails, the destination directory will be
66
66
            try:
67
67
                symlink_target = tree.get_symlink_target(ie.file_id)
68
68
                os.symlink(symlink_target, fullpath)
69
 
            except OSError,e:
 
69
            except OSError, e:
70
70
                raise errors.BzrError(
71
71
                    "Failed to create symlink %r -> %r, error: %s"
72
72
                    % (fullpath, symlink_target, e))
96
96
        if force_mtime is not None:
97
97
            mtime = force_mtime
98
98
        else:
99
 
            mtime = tree.get_file_mtime(tree.path2id(relpath), relpath)
 
99
            if subdir is None:
 
100
                file_id = tree.path2id(relpath)
 
101
            else:
 
102
                file_id = tree.path2id(osutils.pathjoin(subdir, relpath))
 
103
            mtime = tree.get_file_mtime(file_id, relpath)
100
104
        os.utime(fullpath, (mtime, mtime))
101
105
 
102
106
        yield
103
 
        
104
 
def dir_exporter(tree, dest, root, subdir=None, filtered=False, 
105
 
                 force_mtime=None, fileobj=None):
106
 
 
107
 
    for _ in dir_exporter_generator(tree, dest, root, subdir, filtered,
108
 
                                    force_mtime, fileobj):
109
 
        pass