~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_export.py

  • Committer: Joe Julian
  • Date: 2010-01-10 02:25:31 UTC
  • mto: (4634.119.7 2.0)
  • mto: This revision was merged to the branch mainline in revision 4959.
  • Revision ID: joe@julianfamily.org-20100110022531-wqk61rsagz8xsiga
Added MANIFEST.in to allow bdist_rpm to have all the required include files and tools. bdist_rpm will still fail to build correctly on some distributions due to a disttools bug http://bugs.python.org/issue644744

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010 Canonical Ltd
 
1
# Copyright (C) 2009 Canonical Ltd
2
2
#
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
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
import os
18
 
import time
 
18
 
19
19
 
20
20
from bzrlib import (
21
21
    errors,
62
62
        wt.commit('1')
63
63
        self.build_tree(['target/', 'target/foo'])
64
64
        self.assertRaises(errors.BzrError, export.export, wt, 'target', format="dir")
65
 
 
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'])
70
 
        wtree.commit('1')
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')
75
 
        
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()
86
 
        b.lock_read()
87
 
        self.addCleanup(b.unlock)
88
 
        tree = b.basis_tree()
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):
93
 
                yield thing
94
 
                time.sleep(1)
95
 
        tree.iter_files_bytes = iter_files_bytes
96
 
        export.export(tree, 'target', format='dir')
97
 
        t = self.get_transport('target')
98
 
        st_a = t.stat('a')
99
 
        st_b = t.stat('b')
100
 
        # All files must be given the same mtime.
101
 
        self.assertEqual(st_a.st_mtime, st_b.st_mtime)