Merge lp://qastaging/~maxb/bzrtools/skip-import-.bzr into lp://qastaging/bzrtools

Proposed by Max Bowsher
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~maxb/bzrtools/skip-import-.bzr
Merge into: lp://qastaging/bzrtools
Diff against target: 58 lines (+24/-0)
2 files modified
tests/upstream_import.py (+18/-0)
upstream_import.py (+6/-0)
To merge this branch: bzr merge lp://qastaging/~maxb/bzrtools/skip-import-.bzr
Reviewer Review Type Date Requested Status
Aaron Bentley Approve
Review via email: mp+14593@code.qastaging.launchpad.net
To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Max Bowsher wrote:
> Max Bowsher has proposed merging lp:~maxb/bzrtools/skip-import-.bzr into lp:bzrtools.
>
> Requested reviews:
> Aaron Bentley (abentley)
> Related bugs:
> #237933 attempting to import a directory/archive containing a .bzr directory gives a fatal "tree transform is malformed" error
> https://bugs.launchpad.net/bugs/237933

 review resubmit

This looks like a reasonable change, but needs tests. Existing tests
are in bzrtools/tests/upstream_import.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkr4+ZsACgkQ0F+nu1YWqI3GLACfc0cUm+2HNViCsm/zHdI4XhTz
35QAnRExkzUppFYLWE7triL7hkA99Nb3
=pff6
-----END PGP SIGNATURE-----

review: Needs Resubmitting
732. By Max Bowsher

Having discovered that bzr-builddeb import_dsc.py is a horrid copy-paste job of bzrtools upstream_import.py, restructure the change to minimize divergence from it.

733. By Max Bowsher

Add a very simple test.

Revision history for this message
Max Bowsher (maxb) wrote :

Is this very simple test acceptable?

If not, can you guide me to what needs to be checked in more depth?

Revision history for this message
Aaron Bentley (abentley) wrote :

This looks good. Sorry for the delay merging it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/upstream_import.py'
--- tests/upstream_import.py 2009-04-10 21:09:41 +0000
+++ tests/upstream_import.py 2010-02-09 09:13:11 +0000
@@ -154,6 +154,18 @@
154 return ZipFileWrapper(fileobj, 'w')154 return ZipFileWrapper(fileobj, 'w')
155 return self.make_archive(maker)155 return self.make_archive(maker)
156156
157 def make_tar_with_bzrdir(self):
158 result = StringIO()
159 tar_file = tarfile.open('tar-with-bzrdir.tar', 'w', result)
160 os.mkdir('toplevel-dir')
161 tar_file.add('toplevel-dir')
162 os.mkdir('toplevel-dir/.bzr')
163 tar_file.add('toplevel-dir/.bzr')
164 tar_file.close()
165 rmtree('toplevel-dir')
166 result.seek(0)
167 return result
168
157 def test_top_path(self):169 def test_top_path(self):
158 self.assertEqual(top_path('ab/b/c'), 'ab')170 self.assertEqual(top_path('ab/b/c'), 'ab')
159 self.assertEqual(top_path('etc'), 'etc')171 self.assertEqual(top_path('etc'), 'etc')
@@ -223,5 +235,11 @@
223 import_tar(tree, tar_file)235 import_tar(tree, tar_file)
224 self.assertTrue(tree.path2id('README') is not None)236 self.assertTrue(tree.path2id('README') is not None)
225237
238 def test_no_crash_with_bzrdir(self):
239 tar_file = self.make_tar_with_bzrdir()
240 tree = BzrDir.create_standalone_workingtree('tree')
241 import_tar(tree, tar_file)
242 # So long as it did not crash, that should be ok
243
226def test_suite():244def test_suite():
227 return makeSuite(TestImport)245 return makeSuite(TestImport)
228246
=== modified file 'upstream_import.py'
--- upstream_import.py 2009-04-10 21:09:41 +0000
+++ upstream_import.py 2010-02-09 09:13:11 +0000
@@ -163,6 +163,10 @@
163 yield member.name163 yield member.name
164164
165165
166def should_ignore(relative_path):
167 return top_path(relative_path) == '.bzr'
168
169
166def import_tar(tree, tar_input):170def import_tar(tree, tar_input):
167 """Replace the contents of a working directory with tarfile contents.171 """Replace the contents of a working directory with tarfile contents.
168 The tarfile may be a gzipped stream. File ids will be updated.172 The tarfile may be a gzipped stream. File ids will be updated.
@@ -203,6 +207,8 @@
203 relative_path = relative_path.rstrip('/')207 relative_path = relative_path.rstrip('/')
204 if relative_path == '':208 if relative_path == '':
205 continue209 continue
210 if should_ignore(relative_path):
211 continue
206 add_implied_parents(implied_parents, relative_path)212 add_implied_parents(implied_parents, relative_path)
207 trans_id = tt.trans_id_tree_path(relative_path)213 trans_id = tt.trans_id_tree_path(relative_path)
208 added.add(relative_path.rstrip('/'))214 added.add(relative_path.rstrip('/'))

Subscribers

People subscribed via source and target branches