63
63
self.build_tree(['target/', 'target/foo'])
64
64
self.assertRaises(errors.BzrError, export.export, wt, 'target', format="dir")
66
def test_dir_export_existing_single_file(self):
67
self.build_tree(['dir1/', 'dir1/dir2/', 'dir1/first', 'dir1/dir2/second'])
68
wtree = self.make_branch_and_tree('dir1')
69
wtree.add(['dir2', 'first', 'dir2/second'])
71
export.export(wtree, 'target1', format='dir', subdir='first')
72
self.failUnlessExists('target1/first')
73
export.export(wtree, 'target2', format='dir', subdir='dir2/second')
74
self.failUnlessExists('target2/second')
76
def test_dir_export_files_same_timestamp(self):
77
builder = self.make_branch_builder('source')
78
builder.start_series()
79
builder.build_snapshot(None, None, [
80
('add', ('', 'root-id', 'directory', '')),
81
('add', ('a', 'a-id', 'file', 'content\n'))])
82
builder.build_snapshot(None, None, [
83
('add', ('b', 'b-id', 'file', 'content\n'))])
84
builder.finish_series()
85
b = builder.get_branch()
87
self.addCleanup(b.unlock)
89
orig_iter_files_bytes = tree.iter_files_bytes
90
# Make iter_files_bytes slower, so we provoke mtime skew
91
def iter_files_bytes(to_fetch):
92
for thing in orig_iter_files_bytes(to_fetch):
95
tree.iter_files_bytes = iter_files_bytes
96
export.export(tree, 'target', format='dir')
97
t = self.get_transport('target')
100
# All files must be given the same mtime.
101
self.assertEqual(st_a.st_mtime, st_b.st_mtime)