164
164
tf = tarfile.open('target.tar.gz')
165
165
self.assertEquals(["target/a"], tf.getnames())
167
def test_tgz_ignores_dest_path(self):
168
# The target path should not be a part of the target file.
170
wt = self.make_branch_and_tree('.')
171
self.build_tree(['a'])
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)
167
193
def test_tbz2(self):
168
194
wt = self.make_branch_and_tree('.')
169
195
self.build_tree(['a'])