~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: 2011-06-15 13:00:55 UTC
  • mfrom: (5973.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20110615130055-anv7vid86fsmrj17
Bug #795557,
        allow exporting a subdir when also exporting the timestamps.
        (Szilveszter Farkas)

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
        self.assertEqual(a_time, t.stat('a').st_mtime)
147
147
        self.assertEqual(b_time, t.stat('b').st_mtime)
148
148
 
 
149
    def test_subdir_files_per_timestamps(self):
 
150
        builder = self.make_branch_builder('source')
 
151
        builder.start_series()
 
152
        foo_time = time.mktime((1999, 12, 12, 0, 0, 0, 0, 0, 0))
 
153
        builder.build_snapshot(None, None, [
 
154
            ('add', ('', 'root-id', 'directory', '')),
 
155
            ('add', ('subdir', 'subdir-id', 'directory', '')),
 
156
            ('add', ('subdir/foo.txt', 'foo-id', 'file', 'content\n'))],
 
157
            timestamp=foo_time)
 
158
        builder.finish_series()
 
159
        b = builder.get_branch()
 
160
        b.lock_read()
 
161
        self.addCleanup(b.unlock)
 
162
        tree = b.basis_tree()
 
163
        export.export(tree, 'target', format='dir', subdir='subdir',
 
164
            per_file_timestamps=True)
 
165
        t = self.get_transport('target')
 
166
        self.assertEquals(foo_time, t.stat('foo.txt').st_mtime)
 
167
 
149
168
 
150
169
class TarExporterTests(tests.TestCaseWithTransport):
151
170