~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_export.py

  • Committer: Jelmer Vernooij
  • Date: 2011-03-13 22:09:09 UTC
  • mto: This revision was merged to the branch mainline in revision 5724.
  • Revision ID: jelmer@samba.org-20110313220909-u654euthfvq912fe
Only write out basename of the tarfile to the gzip file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
        tf = tarfile.open('target.tar.gz')
165
165
        self.assertEquals(["target/a"], tf.getnames())
166
166
 
 
167
    def test_tgz_ignores_dest_path(self):
 
168
        # The target path should not be a part of the target file.
 
169
        # (bug #102234)
 
170
        wt = self.make_branch_and_tree('.')
 
171
        self.build_tree(['a'])
 
172
        wt.add(["a"])
 
173
        wt.commit("1")
 
174
        os.mkdir("testdir1")
 
175
        os.mkdir("testdir2")
 
176
        export.export(wt, 'testdir1/target.tar.gz', format="tgz",
 
177
            per_file_timestamps=True)
 
178
        export.export(wt, 'testdir2/target.tar.gz', format="tgz",
 
179
            per_file_timestamps=True)
 
180
        file1 = open('testdir1/target.tar.gz', 'r')
 
181
        self.addCleanup(file1.close)
 
182
        file2 = open('testdir1/target.tar.gz', 'r')
 
183
        self.addCleanup(file2.close)
 
184
        content1 = file1.read()
 
185
        content2 = file2.read()
 
186
        self.assertEqualDiff(content1, content2)
 
187
        # the gzip module doesn't have a way to read back to the original
 
188
        # filename, but it's stored as-is in the tarfile.
 
189
        self.assertFalse("testdir1" in content1)
 
190
        self.assertFalse("target.tar.gz" in content1)
 
191
        self.assertTrue("target.tar" in content1)
 
192
 
167
193
    def test_tbz2(self):
168
194
        wt = self.make_branch_and_tree('.')
169
195
        self.build_tree(['a'])