3408.7.1
by Martin Pool
Support tarball export to stdout |
1 |
# Copyright (C) 2005, 2006, 2008 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 |
)
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
33 |
from bzrlib.tests.blackbox import ExternalBase |
2024.2.1
by John Arbash Meinel
Fix bug #56815 by exporting paths in utf8 to tarfile and zipfile |
34 |
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
35 |
|
36 |
class TestExport(ExternalBase): |
|
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 |
|
88 |
def test_zip_export(self): |
|
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
89 |
tree = self.make_branch_and_tree('zip') |
90 |
self.build_tree(['zip/a']) |
|
91 |
tree.add('a') |
|
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
92 |
self.build_tree_contents([('zip/.bzrrules', '')]) |
93 |
tree.add('.bzrrules') |
|
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
94 |
self.build_tree(['zip/.bzr-adir/', 'zip/.bzr-adir/afile']) |
95 |
tree.add(['.bzr-adir/', '.bzr-adir/afile']) |
|
1185.61.1
by Jamie Wilkinson
add blackbox tests for ensuring .bzrignore is not exported |
96 |
|
97 |
os.chdir('zip') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
98 |
self.run_bzr('ignore something') |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
99 |
tree.commit('1') |
100 |
||
101 |
self.failUnless(tree.has_filename('.bzrignore')) |
|
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
102 |
self.failUnless(tree.has_filename('.bzrrules')) |
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
103 |
self.failUnless(tree.has_filename('.bzr-adir')) |
104 |
self.failUnless(tree.has_filename('.bzr-adir/afile')) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
105 |
self.run_bzr('export test.zip') |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
106 |
|
107 |
zfile = zipfile.ZipFile('test.zip') |
|
108 |
# Make sure the zipfile contains 'a', but does not contain
|
|
109 |
# '.bzrignore'.
|
|
110 |
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 |
111 |
|
112 |
def test_zip_export_unicode(self): |
|
113 |
tree = self.make_branch_and_tree('zip') |
|
4241.9.5
by Vincent Ladeuil
Fix unicode related OSX failures. |
114 |
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 |
115 |
try: |
116 |
self.build_tree(['zip/' + fname]) |
|
117 |
except UnicodeError: |
|
4241.9.1
by Vincent Ladeuil
Fix test_tar_export erroring test. |
118 |
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 |
119 |
tree.add([fname]) |
120 |
tree.commit('first') |
|
121 |
||
122 |
os.chdir('zip') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
123 |
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 |
124 |
zfile = zipfile.ZipFile('test.zip') |
125 |
# all paths are prefixed with the base name of the zipfile
|
|
126 |
self.assertEqual(['test/' + fname.encode('utf8')], |
|
127 |
sorted(zfile.namelist())) |
|
1185.61.5
by Jamie Wilkinson
add test for directory export |
128 |
|
2024.2.6
by John Arbash Meinel
In zip files, directories must have trailing slashes |
129 |
def test_zip_export_directories(self): |
130 |
tree = self.make_branch_and_tree('zip') |
|
131 |
self.build_tree(['zip/a', 'zip/b/', 'zip/b/c', 'zip/d/']) |
|
132 |
tree.add(['a', 'b', 'b/c', 'd']) |
|
133 |
tree.commit('init') |
|
134 |
||
135 |
os.chdir('zip') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
136 |
self.run_bzr('export test.zip') |
2024.2.6
by John Arbash Meinel
In zip files, directories must have trailing slashes |
137 |
zfile = zipfile.ZipFile('test.zip') |
138 |
names = sorted(zfile.namelist()) |
|
2024.2.7
by John Arbash Meinel
Set the external_attr bits so Windows respects our directories |
139 |
|
2024.2.8
by John Arbash Meinel
paths are always forward slashed for python zipfiles |
140 |
# even on win32, zipfile.ZipFile changes all names to use
|
141 |
# forward slashes
|
|
142 |
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 |
143 |
|
2024.2.8
by John Arbash Meinel
paths are always forward slashed for python zipfiles |
144 |
file_attr = stat.S_IFREG |
4241.9.1
by Vincent Ladeuil
Fix test_tar_export erroring test. |
145 |
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 |
146 |
|
147 |
a_info = zfile.getinfo(names[0]) |
|
148 |
self.assertEqual(file_attr, a_info.external_attr) |
|
149 |
||
150 |
b_info = zfile.getinfo(names[1]) |
|
151 |
self.assertEqual(dir_attr, b_info.external_attr) |
|
152 |
||
153 |
c_info = zfile.getinfo(names[2]) |
|
154 |
self.assertEqual(file_attr, c_info.external_attr) |
|
155 |
||
156 |
d_info = zfile.getinfo(names[3]) |
|
157 |
self.assertEqual(dir_attr, d_info.external_attr) |
|
2024.2.6
by John Arbash Meinel
In zip files, directories must have trailing slashes |
158 |
|
1185.61.5
by Jamie Wilkinson
add test for directory export |
159 |
def test_dir_export(self): |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
160 |
tree = self.make_branch_and_tree('dir') |
161 |
self.build_tree(['dir/a']) |
|
162 |
tree.add('a') |
|
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
163 |
self.build_tree_contents([('dir/.bzrrules', '')]) |
164 |
tree.add('.bzrrules') |
|
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
165 |
self.build_tree(['dir/.bzr-adir/', 'dir/.bzr-adir/afile']) |
166 |
tree.add(['.bzr-adir/', '.bzr-adir/afile']) |
|
1185.61.5
by Jamie Wilkinson
add test for directory export |
167 |
|
168 |
os.chdir('dir') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
169 |
self.run_bzr('ignore something') |
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
170 |
tree.commit('1') |
1185.61.5
by Jamie Wilkinson
add test for directory export |
171 |
|
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
172 |
self.failUnless(tree.has_filename('.bzrignore')) |
3577.3.1
by Ian Clatworthy
do not export .bzrrules |
173 |
self.failUnless(tree.has_filename('.bzrrules')) |
3577.3.2
by Ian Clatworthy
tweaks following jam's review |
174 |
self.failUnless(tree.has_filename('.bzr-adir')) |
175 |
self.failUnless(tree.has_filename('.bzr-adir/afile')) |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
176 |
self.run_bzr('export direxport') |
1185.61.5
by Jamie Wilkinson
add test for directory export |
177 |
|
178 |
files = sorted(os.listdir('direxport')) |
|
2024.2.2
by John Arbash Meinel
Cleanup the export tests to act more like the current api. |
179 |
# Make sure the exported directory contains 'a', but does not contain
|
180 |
# '.bzrignore'.
|
|
181 |
self.assertEqual(['a'], files) |
|
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
182 |
|
183 |
def example_branch(self): |
|
3613.2.1
by Robert Collins
Teach export how to export a subdirectory. (Robert Collins) |
184 |
"""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 |
185 |
tree = self.make_branch_and_tree('branch') |
2024.2.4
by John Arbash Meinel
Use build_tree_contents instead of manually opening the file |
186 |
self.build_tree_contents([('branch/hello', 'foo')]) |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
187 |
tree.add('hello') |
188 |
tree.commit('setup') |
|
189 |
||
2024.2.4
by John Arbash Meinel
Use build_tree_contents instead of manually opening the file |
190 |
self.build_tree_contents([('branch/goodbye', 'baz')]) |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
191 |
tree.add('goodbye') |
192 |
tree.commit('setup') |
|
193 |
return tree |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
194 |
|
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
195 |
def test_basic_directory_export(self): |
196 |
self.example_branch() |
|
197 |
os.chdir('branch') |
|
198 |
||
199 |
# Directory exports
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
200 |
self.run_bzr('export ../latest') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
201 |
self.assertEqual(['goodbye', 'hello'], sorted(os.listdir('../latest'))) |
202 |
self.check_file_contents('../latest/goodbye', 'baz') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
203 |
self.run_bzr('export ../first -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
204 |
self.assertEqual(['hello'], sorted(os.listdir('../first'))) |
205 |
self.check_file_contents('../first/hello', 'foo') |
|
206 |
||
207 |
# Even with .gz and .bz2 it is still a directory
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
208 |
self.run_bzr('export ../first.gz -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
209 |
self.check_file_contents('../first.gz/hello', 'foo') |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
210 |
self.run_bzr('export ../first.bz2 -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
211 |
self.check_file_contents('../first.bz2/hello', 'foo') |
212 |
||
213 |
def test_basic_tarfile_export(self): |
|
214 |
self.example_branch() |
|
215 |
os.chdir('branch') |
|
216 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
217 |
self.run_bzr('export ../first.tar -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
218 |
self.failUnless(os.path.isfile('../first.tar')) |
219 |
tf = tarfile.open('../first.tar') |
|
220 |
try: |
|
221 |
self.assertEqual(['first/hello'], sorted(tf.getnames())) |
|
222 |
self.assertEqual('foo', tf.extractfile('first/hello').read()) |
|
223 |
finally: |
|
224 |
tf.close() |
|
225 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
226 |
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 |
227 |
self.failUnless(os.path.isfile('../first.tar.gz')) |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
228 |
self.run_bzr('export ../first.tbz2 -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
229 |
self.failUnless(os.path.isfile('../first.tbz2')) |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
230 |
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 |
231 |
self.failUnless(os.path.isfile('../first.tar.bz2')) |
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
232 |
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 |
233 |
self.failUnless(os.path.isfile('../first.tar.tbz2')) |
234 |
||
235 |
tf = tarfile.open('../first.tar.tbz2', 'r:bz2') |
|
236 |
try: |
|
237 |
self.assertEqual(['first.tar/hello'], sorted(tf.getnames())) |
|
238 |
self.assertEqual('foo', tf.extractfile('first.tar/hello').read()) |
|
239 |
finally: |
|
240 |
tf.close() |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
241 |
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 |
242 |
tf = tarfile.open('../first2.tar') |
243 |
try: |
|
244 |
self.assertEqual(['pizza/hello'], sorted(tf.getnames())) |
|
245 |
self.assertEqual('foo', tf.extractfile('pizza/hello').read()) |
|
246 |
finally: |
|
247 |
tf.close() |
|
248 |
||
249 |
def test_basic_zipfile_export(self): |
|
250 |
self.example_branch() |
|
251 |
os.chdir('branch') |
|
252 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
253 |
self.run_bzr('export ../first.zip -r 1') |
2024.2.3
by John Arbash Meinel
Move out export tests from test_too_much, refactor |
254 |
self.failUnlessExists('../first.zip') |
255 |
zf = zipfile.ZipFile('../first.zip') |
|
256 |
try: |
|
257 |
self.assertEqual(['first/hello'], sorted(zf.namelist())) |
|
258 |
self.assertEqual('foo', zf.read('first/hello')) |
|
259 |
finally: |
|
260 |
zf.close() |
|
261 |
||
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
262 |
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 |
263 |
zf = zipfile.ZipFile('../first2.zip') |
264 |
try: |
|
265 |
self.assertEqual(['pizza/hello'], sorted(zf.namelist())) |
|
266 |
self.assertEqual('foo', zf.read('pizza/hello')) |
|
267 |
finally: |
|
268 |
zf.close() |
|
3943.8.1
by Marius Kruger
remove all trailing whitespace from bzr source |
269 |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
270 |
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 |
271 |
zf = zipfile.ZipFile('../first-zip') |
272 |
try: |
|
273 |
self.assertEqual(['first-zip/hello'], sorted(zf.namelist())) |
|
274 |
self.assertEqual('foo', zf.read('first-zip/hello')) |
|
275 |
finally: |
|
276 |
zf.close() |
|
277 |
||
2099.1.1
by Daniel Silverstone
Add source branch support to export command |
278 |
def test_export_from_outside_branch(self): |
279 |
self.example_branch() |
|
280 |
||
281 |
# Use directory exports to test stating the branch location
|
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
282 |
self.run_bzr('export latest branch') |
2099.1.1
by Daniel Silverstone
Add source branch support to export command |
283 |
self.assertEqual(['goodbye', 'hello'], sorted(os.listdir('latest'))) |
284 |
self.check_file_contents('latest/goodbye', 'baz') |
|
2552.2.3
by Vincent Ladeuil
Deprecate the varargs syntax and fix the tests. |
285 |
self.run_bzr('export first -r 1 branch') |
2099.1.1
by Daniel Silverstone
Add source branch support to export command |
286 |
self.assertEqual(['hello'], sorted(os.listdir('first'))) |
287 |
self.check_file_contents('first/hello', 'foo') |
|
3613.2.1
by Robert Collins
Teach export how to export a subdirectory. (Robert Collins) |
288 |
|
289 |
def test_export_partial_tree(self): |
|
290 |
tree = self.example_branch() |
|
291 |
self.build_tree(['branch/subdir/', 'branch/subdir/foo.txt']) |
|
292 |
tree.smart_add(['branch']) |
|
293 |
tree.commit('more setup') |
|
294 |
out, err = self.run_bzr('export exported branch/subdir') |
|
295 |
self.assertEqual(['foo.txt'], os.listdir('exported')) |