4763.2.4
by John Arbash Meinel
merge bzr.2.1 in preparation for NEWS entry. |
1 |
# Copyright (C) 2005-2010 Canonical Ltd
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
2 |
#
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
3 |
# This program is free software; you can redistribute it and/or modify
|
4 |
# it under the terms of the GNU General Public License as published by
|
|
5 |
# the Free Software Foundation; either version 2 of the License, or
|
|
6 |
# (at your option) any later version.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
7 |
#
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
8 |
# This program is distributed in the hope that it will be useful,
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
# GNU General Public License for more details.
|
|
1887.1.1
by Adeodato Simó
Do not separate paragraphs in the copyright statement with blank lines, |
12 |
#
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
13 |
# You should have received a copy of the GNU General Public License
|
14 |
# along with this program; if not, write to the Free Software
|
|
4183.7.1
by Sabin Iacob
update FSF mailing address |
15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
16 |
|
17 |
||
18 |
"""Black-box tests for bzr export.
|
|
19 |
"""
|
|
20 |
||
3408.7.1
by Martin Pool
Support tarball export to stdout |
21 |
from StringIO import StringIO |
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
22 |
import os |
2024.2.7
by John Arbash Meinel
Set the external_attr bits so Windows respects our directories |
23 |
import stat |
2024.2.6
by John Arbash Meinel
In zip files, directories must have trailing slashes |
24 |
import sys |
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
25 |
import tarfile |
26 |
import zipfile |
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
27 |
|
4241.9.1
by Vincent Ladeuil
Fix test_tar_export erroring test. |
28 |
|
29 |
from bzrlib import ( |
|
30 |
export, |
|
31 |
tests, |
|
2024.2.7
by John Arbash Meinel
Set the external_attr bits so Windows respects our directories |
32 |
)
|
5283.4.5
by Martin Pool
Update remaining subclasses of ExternalBase |
33 |
from bzrlib.tests import TestCaseWithTransport |
34 |
||
35 |
||
36 |
class TestExport(TestCaseWithTransport): |
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
37 |
|
38 |
def test_tar_export(self): |
|
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
39 |
tree = self.make_branch_and_tree('tar') |
40 |
self.build_tree(['tar/a']) |
|
41 |
tree.add('a') |
|
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
42 |
self.build_tree_contents([('tar/.bzrrules', '')]) |
43 |
tree.add('.bzrrules') |
|
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
44 |
self.build_tree(['tar/.bzr-adir/', 'tar/.bzr-adir/afile']) |
45 |
tree.add(['.bzr-adir/', '.bzr-adir/afile']) |
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
46 |
|
47 |
os.chdir('tar') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
48 |
self.run_bzr('ignore something') |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
49 |
tree.commit('1') |
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
50 |
|
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
51 |
self.failUnless(tree.has_filename('.bzrignore')) |
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
52 |
self.failUnless(tree.has_filename('.bzrrules')) |
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
53 |
self.failUnless(tree.has_filename('.bzr-adir')) |
54 |
self.failUnless(tree.has_filename('.bzr-adir/afile')) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
55 |
self.run_bzr('export test.tar.gz') |
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
56 |
ball = tarfile.open('test.tar.gz') |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
57 |
# Make sure the tarball contains 'a', but does not contain
|
58 |
# '.bzrignore'.
|
|
59 |
self.assertEqual(['test/a'], sorted(ball.getnames())) |
|
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
60 |
|
3638.3.9
by Vincent Ladeuil
Fix tar-related failing test (python-2.5.1 bug). |
61 |
if sys.version_info < (2, 5, 2) and sys.platform == 'darwin': |
62 |
raise tests.KnownFailure('python %r has a tar related bug, upgrade' |
|
4398.2.1
by jszakmeister
Wrap the argument to the KnownFailure string as a tuple to keep from getting an error about not consuming all the arguments. |
63 |
% (sys.version_info,)) |
3408.7.1
by Martin Pool
Support tarball export to stdout |
64 |
out, err = self.run_bzr('export --format=tgz --root=test -') |
65 |
ball = tarfile.open('', fileobj=StringIO(out)) |
|
66 |
self.assertEqual(['test/a'], sorted(ball.getnames())) |
|
67 |
||
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
68 |
def test_tar_export_unicode(self): |
69 |
tree = self.make_branch_and_tree('tar') |
|
4241.9.5
by Vincent Ladeuil
Fix unicode related OSX failures. |
70 |
# FIXME: using fname = u'\xe5.txt' below triggers a bug revealed since
|
71 |
# bzr.dev revno 4216 but more related to OSX/working trees/unicode than
|
|
4241.9.6
by Vincent Ladeuil
Add NEWS entry. |
72 |
# export itself --vila 20090406
|
4241.9.5
by Vincent Ladeuil
Fix unicode related OSX failures. |
73 |
fname = u'\N{Euro Sign}.txt' |
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
74 |
try: |
75 |
self.build_tree(['tar/' + fname]) |
|
76 |
except UnicodeError: |
|
4241.9.1
by Vincent Ladeuil
Fix test_tar_export erroring test. |
77 |
raise tests.TestSkipped('Unable to represent path %r' % (fname,)) |
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
78 |
tree.add([fname]) |
79 |
tree.commit('first') |
|
80 |
||
81 |
os.chdir('tar') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
82 |
self.run_bzr('export test.tar') |
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
83 |
ball = tarfile.open('test.tar') |
84 |
# all paths are prefixed with the base name of the tarball
|
|
85 |
self.assertEqual(['test/' + fname.encode('utf8')], |
|
86 |
sorted(ball.getnames())) |
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
87 |
|
5152.1.1
by Parth Malwankar
Fixed bug #413406. unicode names for parent directory |
88 |
def test_tar_export_unicode_basedir(self): |
89 |
"""Test for bug #413406"""
|
|
90 |
basedir = u'\N{euro sign}' |
|
91 |
os.mkdir(basedir) |
|
92 |
os.chdir(basedir) |
|
93 |
self.run_bzr(['init', 'branch']) |
|
94 |
os.chdir('branch') |
|
95 |
self.run_bzr(['export', '--format', 'tgz', u'test.tar.gz']) |
|
96 |
||
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
97 |
def test_zip_export(self): |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
98 |
tree = self.make_branch_and_tree('zip') |
99 |
self.build_tree(['zip/a']) |
|
100 |
tree.add('a') |
|
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
101 |
self.build_tree_contents([('zip/.bzrrules', '')]) |
102 |
tree.add('.bzrrules') |
|
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
103 |
self.build_tree(['zip/.bzr-adir/', 'zip/.bzr-adir/afile']) |
104 |
tree.add(['.bzr-adir/', '.bzr-adir/afile']) |
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
105 |
|
106 |
os.chdir('zip') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
107 |
self.run_bzr('ignore something') |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
108 |
tree.commit('1') |
109 |
||
110 |
self.failUnless(tree.has_filename('.bzrignore')) |
|
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
111 |
self.failUnless(tree.has_filename('.bzrrules')) |
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
112 |
self.failUnless(tree.has_filename('.bzr-adir')) |
113 |
self.failUnless(tree.has_filename('.bzr-adir/afile')) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
114 |
self.run_bzr('export test.zip') |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
115 |
|
116 |
zfile = zipfile.ZipFile('test.zip') |
|
117 |
# Make sure the zipfile contains 'a', but does not contain
|
|
118 |
# '.bzrignore'.
|
|
119 |
self.assertEqual(['test/a'], sorted(zfile.namelist())) |
|
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
120 |
|
121 |
def test_zip_export_unicode(self): |
|
122 |
tree = self.make_branch_and_tree('zip') |
|
4241.9.5
by Vincent Ladeuil
Fix unicode related OSX failures. |
123 |
fname = u'\N{Euro Sign}.txt' |
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
124 |
try: |
125 |
self.build_tree(['zip/' + fname]) |
|
126 |
except UnicodeError: |
|
4241.9.1
by Vincent Ladeuil
Fix test_tar_export erroring test. |
127 |
raise tests.TestSkipped('Unable to represent path %r' % (fname,)) |
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
128 |
tree.add([fname]) |
129 |
tree.commit('first') |
|
130 |
||
131 |
os.chdir('zip') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
132 |
self.run_bzr('export test.zip') |
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
133 |
zfile = zipfile.ZipFile('test.zip') |
134 |
# all paths are prefixed with the base name of the zipfile
|
|
135 |
self.assertEqual(['test/' + fname.encode('utf8')], |
|
136 |
sorted(zfile.namelist())) |
|
1185.61.5
by Jamie Wilkinson
add test for directory export |
137 |
|
2024.2.6
by John Arbash Meinel
In zip files, directories must have trailing slashes |
138 |
def test_zip_export_directories(self): |
139 |
tree = self.make_branch_and_tree('zip') |
|
140 |
self.build_tree(['zip/a', 'zip/b/', 'zip/b/c', 'zip/d/']) |
|
141 |
tree.add(['a', 'b', 'b/c', 'd']) |
|
142 |
tree.commit('init') |
|
143 |
||
144 |
os.chdir('zip') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
145 |
self.run_bzr('export test.zip') |
2024.2.6
by John Arbash Meinel
In zip files, directories must have trailing slashes |
146 |
zfile = zipfile.ZipFile('test.zip') |
147 |
names = sorted(zfile.namelist()) |
|
2024.2.7
by John Arbash Meinel
Set the external_attr bits so Windows respects our directories |
148 |
|
2024.2.8
by John Arbash Meinel
paths are always forward slashed for python zipfiles |
149 |
# even on win32, zipfile.ZipFile changes all names to use
|
150 |
# forward slashes
|
|
151 |
self.assertEqual(['test/a', 'test/b/', 'test/b/c', 'test/d/'], names) |
|
2024.2.7
by John Arbash Meinel
Set the external_attr bits so Windows respects our directories |
152 |
|
4823.1.2
by Ivan Sagalaev
File mode is given a name and gets tested |
153 |
file_attr = stat.S_IFREG | export.zip_exporter.FILE_PERMISSIONS |
4241.9.1
by Vincent Ladeuil
Fix test_tar_export erroring test. |
154 |
dir_attr = stat.S_IFDIR | export.zip_exporter.ZIP_DIRECTORY_BIT |
2024.2.7
by John Arbash Meinel
Set the external_attr bits so Windows respects our directories |
155 |
|
156 |
a_info = zfile.getinfo(names[0]) |
|
157 |
self.assertEqual(file_attr, a_info.external_attr) |
|
158 |
||
159 |
b_info = zfile.getinfo(names[1]) |
|
160 |
self.assertEqual(dir_attr, b_info.external_attr) |
|
161 |
||
162 |
c_info = zfile.getinfo(names[2]) |
|
163 |
self.assertEqual(file_attr, c_info.external_attr) |
|
164 |
||
165 |
d_info = zfile.getinfo(names[3]) |
|
166 |
self.assertEqual(dir_attr, d_info.external_attr) |
|
2024.2.6
by John Arbash Meinel
In zip files, directories must have trailing slashes |
167 |
|
1185.61.5
by Jamie Wilkinson
add test for directory export |
168 |
def test_dir_export(self): |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
169 |
tree = self.make_branch_and_tree('dir') |
170 |
self.build_tree(['dir/a']) |
|
171 |
tree.add('a') |
|
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
172 |
self.build_tree_contents([('dir/.bzrrules', '')]) |
173 |
tree.add('.bzrrules') |
|
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
174 |
self.build_tree(['dir/.bzr-adir/', 'dir/.bzr-adir/afile']) |
175 |
tree.add(['.bzr-adir/', '.bzr-adir/afile']) |
|
1185.61.5
by Jamie Wilkinson
add test for directory export |
176 |
|
177 |
os.chdir('dir') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
178 |
self.run_bzr('ignore something') |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
179 |
tree.commit('1') |
1185.61.5
by Jamie Wilkinson
add test for directory export |
180 |
|
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
181 |
self.failUnless(tree.has_filename('.bzrignore')) |
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
182 |
self.failUnless(tree.has_filename('.bzrrules')) |
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
183 |
self.failUnless(tree.has_filename('.bzr-adir')) |
184 |
self.failUnless(tree.has_filename('.bzr-adir/afile')) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
185 |
self.run_bzr('export direxport') |
1185.61.5
by Jamie Wilkinson
add test for directory export |
186 |
|
187 |
files = sorted(os.listdir('direxport')) |
|
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
188 |
# Make sure the exported directory contains 'a', but does not contain
|
189 |
# '.bzrignore'.
|
|
190 |
self.assertEqual(['a'], files) |
|
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
191 |
|
192 |
def example_branch(self): |
|
3613.2.1
by Robert Collins
Teach export how to export a subdirectory. (Robert Collins) |
193 |
"""Create a branch a 'branch' containing hello and goodbye."""
|
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
194 |
tree = self.make_branch_and_tree('branch') |
2024.2.4
by John Arbash Meinel
Use build_tree_contents instead of manually opening the file |
195 |
self.build_tree_contents([('branch/hello', 'foo')]) |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
196 |
tree.add('hello') |
197 |
tree.commit('setup') |
|
198 |
||
2024.2.4
by John Arbash Meinel
Use build_tree_contents instead of manually opening the file |
199 |
self.build_tree_contents([('branch/goodbye', 'baz')]) |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
200 |
tree.add('goodbye') |
201 |
tree.commit('setup') |
|
202 |
return tree |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
203 |
|
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
204 |
def test_basic_directory_export(self): |
205 |
self.example_branch() |
|
206 |
os.chdir('branch') |
|
207 |
||
208 |
# Directory exports
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
209 |
self.run_bzr('export ../latest') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
210 |
self.assertEqual(['goodbye', 'hello'], sorted(os.listdir('../latest'))) |
211 |
self.check_file_contents('../latest/goodbye', 'baz') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
212 |
self.run_bzr('export ../first -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
213 |
self.assertEqual(['hello'], sorted(os.listdir('../first'))) |
214 |
self.check_file_contents('../first/hello', 'foo') |
|
215 |
||
216 |
# Even with .gz and .bz2 it is still a directory
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
217 |
self.run_bzr('export ../first.gz -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
218 |
self.check_file_contents('../first.gz/hello', 'foo') |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
219 |
self.run_bzr('export ../first.bz2 -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
220 |
self.check_file_contents('../first.bz2/hello', 'foo') |
221 |
||
222 |
def test_basic_tarfile_export(self): |
|
223 |
self.example_branch() |
|
224 |
os.chdir('branch') |
|
225 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
226 |
self.run_bzr('export ../first.tar -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
227 |
self.failUnless(os.path.isfile('../first.tar')) |
228 |
tf = tarfile.open('../first.tar') |
|
229 |
try: |
|
230 |
self.assertEqual(['first/hello'], sorted(tf.getnames())) |
|
231 |
self.assertEqual('foo', tf.extractfile('first/hello').read()) |
|
232 |
finally: |
|
233 |
tf.close() |
|
234 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
235 |
self.run_bzr('export ../first.tar.gz -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
236 |
self.failUnless(os.path.isfile('../first.tar.gz')) |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
237 |
self.run_bzr('export ../first.tbz2 -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
238 |
self.failUnless(os.path.isfile('../first.tbz2')) |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
239 |
self.run_bzr('export ../first.tar.bz2 -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
240 |
self.failUnless(os.path.isfile('../first.tar.bz2')) |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
241 |
self.run_bzr('export ../first.tar.tbz2 -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
242 |
self.failUnless(os.path.isfile('../first.tar.tbz2')) |
243 |
||
244 |
tf = tarfile.open('../first.tar.tbz2', 'r:bz2') |
|
245 |
try: |
|
246 |
self.assertEqual(['first.tar/hello'], sorted(tf.getnames())) |
|
247 |
self.assertEqual('foo', tf.extractfile('first.tar/hello').read()) |
|
248 |
finally: |
|
249 |
tf.close() |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
250 |
self.run_bzr('export ../first2.tar -r 1 --root pizza') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
251 |
tf = tarfile.open('../first2.tar') |
252 |
try: |
|
253 |
self.assertEqual(['pizza/hello'], sorted(tf.getnames())) |
|
254 |
self.assertEqual('foo', tf.extractfile('pizza/hello').read()) |
|
255 |
finally: |
|
256 |
tf.close() |
|
257 |
||
258 |
def test_basic_zipfile_export(self): |
|
259 |
self.example_branch() |
|
260 |
os.chdir('branch') |
|
261 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
262 |
self.run_bzr('export ../first.zip -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
263 |
self.failUnlessExists('../first.zip') |
264 |
zf = zipfile.ZipFile('../first.zip') |
|
265 |
try: |
|
266 |
self.assertEqual(['first/hello'], sorted(zf.namelist())) |
|
267 |
self.assertEqual('foo', zf.read('first/hello')) |
|
268 |
finally: |
|
269 |
zf.close() |
|
270 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
271 |
self.run_bzr('export ../first2.zip -r 1 --root pizza') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
272 |
zf = zipfile.ZipFile('../first2.zip') |
273 |
try: |
|
274 |
self.assertEqual(['pizza/hello'], sorted(zf.namelist())) |
|
275 |
self.assertEqual('foo', zf.read('pizza/hello')) |
|
276 |
finally: |
|
277 |
zf.close() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
278 |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
279 |
self.run_bzr('export ../first-zip --format=zip -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
280 |
zf = zipfile.ZipFile('../first-zip') |
281 |
try: |
|
282 |
self.assertEqual(['first-zip/hello'], sorted(zf.namelist())) |
|
283 |
self.assertEqual('foo', zf.read('first-zip/hello')) |
|
284 |
finally: |
|
285 |
zf.close() |
|
286 |
||
2099.1.1
by Daniel Silverstone
Add source branch support to export command |
287 |
def test_export_from_outside_branch(self): |
288 |
self.example_branch() |
|
289 |
||
290 |
# Use directory exports to test stating the branch location
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
291 |
self.run_bzr('export latest branch') |
2099.1.1
by Daniel Silverstone
Add source branch support to export command |
292 |
self.assertEqual(['goodbye', 'hello'], sorted(os.listdir('latest'))) |
293 |
self.check_file_contents('latest/goodbye', 'baz') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
294 |
self.run_bzr('export first -r 1 branch') |
2099.1.1
by Daniel Silverstone
Add source branch support to export command |
295 |
self.assertEqual(['hello'], sorted(os.listdir('first'))) |
296 |
self.check_file_contents('first/hello', 'foo') |
|
3613.2.1
by Robert Collins
Teach export how to export a subdirectory. (Robert Collins) |
297 |
|
298 |
def test_export_partial_tree(self): |
|
299 |
tree = self.example_branch() |
|
300 |
self.build_tree(['branch/subdir/', 'branch/subdir/foo.txt']) |
|
301 |
tree.smart_add(['branch']) |
|
302 |
tree.commit('more setup') |
|
303 |
out, err = self.run_bzr('export exported branch/subdir') |
|
304 |
self.assertEqual(['foo.txt'], os.listdir('exported')) |
|
5076.2.2
by Jelmer Vernooij
``bzr export`` now takes an optional argument ``--use-tree-timestamp`` |
305 |
|
5076.2.3
by Jelmer Vernooij
Review comments from Rob. |
306 |
def test_dir_export_per_file_timestamps(self): |
5076.2.2
by Jelmer Vernooij
``bzr export`` now takes an optional argument ``--use-tree-timestamp`` |
307 |
tree = self.example_branch() |
308 |
self.build_tree_contents([('branch/har', 'foo')]) |
|
309 |
tree.add('har') |
|
5151.3.1
by Martin
Fix os.utime test failures, three on FAT filesystems and one with readonly files |
310 |
# Earliest allowable date on FAT32 filesystems is 1980-01-01
|
311 |
tree.commit('setup', timestamp=315532800) |
|
5076.2.3
by Jelmer Vernooij
Review comments from Rob. |
312 |
self.run_bzr('export --per-file-timestamps t branch') |
5076.2.2
by Jelmer Vernooij
``bzr export`` now takes an optional argument ``--use-tree-timestamp`` |
313 |
har_st = os.stat('t/har') |
5151.3.1
by Martin
Fix os.utime test failures, three on FAT filesystems and one with readonly files |
314 |
self.assertEquals(315532800, har_st.st_mtime) |
5076.2.2
by Jelmer Vernooij
``bzr export`` now takes an optional argument ``--use-tree-timestamp`` |
315 |
|
5171.3.7
by Martin von Gagern
Added blackbox tests for --directory option. |
316 |
def test_export_directory(self): |
317 |
"""Test --directory option"""
|
|
318 |
self.example_branch() |
|
319 |
self.run_bzr(['export', '--directory=branch', 'latest']) |
|
320 |
self.assertEqual(['goodbye', 'hello'], sorted(os.listdir('latest'))) |
|
321 |
self.check_file_contents('latest/goodbye', 'baz') |