~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_export.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-03-11 23:20:34 UTC
  • mfrom: (5076.2.5 export-use-tree-timestamp)
  • Revision ID: pqm@pqm.ubuntu.com-20100311232034-x3miloj34rko1mqs
(Jelmer) Add --per-file-timestamps option to 'bzr export'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from bzrlib import (
21
21
    errors,
22
22
    export,
23
 
    osutils,
24
23
    tests,
25
24
    )
26
25
 
99
98
        st_b = t.stat('b')
100
99
        # All files must be given the same mtime.
101
100
        self.assertEqual(st_a.st_mtime, st_b.st_mtime)
 
101
 
 
102
    def test_dir_export_files_per_file_timestamps(self):
 
103
        builder = self.make_branch_builder('source')
 
104
        builder.start_series()
 
105
        builder.build_snapshot(None, None, [
 
106
            ('add', ('', 'root-id', 'directory', '')),
 
107
            ('add', ('a', 'a-id', 'file', 'content\n'))],
 
108
            timestamp=3423)
 
109
        builder.build_snapshot(None, None, [
 
110
            ('add', ('b', 'b-id', 'file', 'content\n'))],
 
111
            timestamp=42)
 
112
        builder.finish_series()
 
113
        b = builder.get_branch()
 
114
        b.lock_read()
 
115
        self.addCleanup(b.unlock)
 
116
        tree = b.basis_tree()
 
117
        export.export(tree, 'target', format='dir', per_file_timestamps=True)
 
118
        t = self.get_transport('target')
 
119
        st_a = t.stat('a')
 
120
        st_b = t.stat('b')
 
121
        self.assertEqual(42.0, st_b.st_mtime)
 
122
        self.assertEqual(3423.0, st_a.st_mtime)