/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/export/dir_exporter.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-13 18:51:51 UTC
  • mto: This revision was merged to the branch mainline in revision 5724.
  • Revision ID: jelmer@samba.org-20110313185151-2dmxb1e1o23cmgx0
per_file_timestamp -> force_mtime.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import errno
20
20
import os
21
 
import time
22
21
 
23
22
from bzrlib import errors, osutils
24
23
from bzrlib.export import _export_iter_entries
29
28
from bzrlib.trace import mutter
30
29
 
31
30
 
32
 
def dir_exporter(tree, dest, root, subdir, filtered=False,
33
 
                 per_file_timestamps=False):
 
31
def dir_exporter(tree, dest, root, subdir, filtered=False, force_mtime=None):
34
32
    """Export this tree to a new directory.
35
33
 
36
34
    `dest` should either not exist or should be empty. If it does not exist it
76
74
    # The data returned here can be in any order, but we've already created all
77
75
    # the directories
78
76
    flags = os.O_CREAT | os.O_TRUNC | os.O_WRONLY | getattr(os, 'O_BINARY', 0)
79
 
    now = time.time()
80
77
    for (relpath, executable), chunks in tree.iter_files_bytes(to_fetch):
81
78
        if filtered:
82
79
            filters = tree._content_filter_stack(relpath)
92
89
            out.writelines(chunks)
93
90
        finally:
94
91
            out.close()
95
 
        if per_file_timestamps:
 
92
        if force_mtime is not None:
 
93
            mtime = force_mtime
 
94
        else:
96
95
            mtime = tree.get_file_mtime(tree.path2id(relpath), relpath)
97
 
        else:
98
 
            mtime = now
99
96
        os.utime(fullpath, (mtime, mtime))