1
# Copyright (C) 2009 Canonical Ltd
1
# Copyright (C) 2009, 2010 Canonical Ltd
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
73
73
export.export(wtree, 'target2', format='dir', subdir='dir2/second')
74
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)