Merge lp:~spiv/bzr-builddeb/unbound-local-623736 into lp:bzr-builddeb

Proposed by Andrew Bennetts
Status: Rejected
Rejected by: James Westby
Proposed branch: lp:~spiv/bzr-builddeb/unbound-local-623736
Merge into: lp:bzr-builddeb
Diff against target: 23 lines (+7/-6)
1 file modified
bzrtools_import.py (+7/-6)
To merge this branch: bzr merge lp:~spiv/bzr-builddeb/unbound-local-623736
Reviewer Review Type Date Requested Status
James Westby Disapprove
Review via email: mp+33609@code.launchpad.net

Description of the change

This should fix an UnboundLocalError in the case where file_ids_from is an empty list.

I took a look at writing a test, but I couldn't find unit tests for the bzrtools_import functions, and I'm not sure how to provoke that situation via less direct APIs. I can at least say it doesn't break any tests :)

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

If you look back a few commits in the file you'll see a change by me;
that commit has tests.

-Rob

Revision history for this message
James Westby (james-w) wrote :

On Wed, 25 Aug 2010 05:20:55 -0000, Andrew Bennetts <email address hidden> wrote:
> Andrew Bennetts has proposed merging lp:~spiv/bzr-builddeb/unbound-local-623736 into lp:bzr-builddeb.
>
> Requested reviews:
> Bzr-builddeb-hackers (bzr-builddeb-hackers)
> Related bugs:
> #623736 bzr crashed with UnboundLocalError in _import_archive()
> https://bugs.launchpad.net/bugs/623736
>
>
> This should fix an UnboundLocalError in the case where file_ids_from
> is an empty list.

Thanks.

> I took a look at writing a test, but I couldn't find unit tests for
> the bzrtools_import functions, and I'm not sure how to provoke that
> situation via less direct APIs. I can at least say it doesn't break
> any tests :)

Feel free to add a TestCase for testing bzrtools_import directly. That
would seem to be the best thing here.

It shouldn't be hard to set up the conditions, as you can import a
directory, and file_ids_from is just passed in directly.

Let me know if you would like me to do it.

Thanks,

James

Revision history for this message
James Westby (james-w) wrote :

Hi,

This has been superseded with my work on this code today.

Thanks for the contribution.

James

review: Disapprove

Unmerged revisions

476. By Andrew Bennetts

Fix UnboundLocalError in _import_archive.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrtools_import.py'
--- bzrtools_import.py 2010-08-19 19:28:08 +0000
+++ bzrtools_import.py 2010-08-25 05:20:55 +0000
@@ -260,12 +260,13 @@
260 tt.delete_versioned(trans_id)260 tt.delete_versioned(trans_id)
261 trans_id = tt.trans_id_file_id(found_file_id)261 trans_id = tt.trans_id_file_id(found_file_id)
262 break262 break
263 if not found_file_id and not existing_file_id:263 else:
264 # No file_id in any of the source trees and no file id in the base264 if not existing_file_id:
265 # tree.265 # No file_id in any of the source trees and no file id in
266 name = basename(member.name.rstrip('/'))266 # the base tree.
267 file_id = generate_ids.gen_file_id(name)267 name = basename(member.name.rstrip('/'))
268 tt.version_file(file_id, trans_id)268 file_id = generate_ids.gen_file_id(name)
269 tt.version_file(file_id, trans_id)
269 path = tree.abspath(relative_path)270 path = tree.abspath(relative_path)
270 if member.name in seen:271 if member.name in seen:
271 if tt.final_kind(trans_id) == 'file':272 if tt.final_kind(trans_id) == 'file':

Subscribers

People subscribed via source and target branches