[MERGE] cleanup progress properly when interrupted during fetch (#54000)
John Arbash Meinel
john at arbash-meinel.com
Mon Sep 25 18:13:41 BST 2006
Aaron Bentley wrote:
> Hi all,
>
> This bundle fixes the cleanup of fetch by making iter_added_or_deleted
> take a progress object, instead of creating one.
>
> Iterators can't generate nested progress bars, because they can't
> guarantee that they will clean them up.
>
> Aaron
+1 on the concept, but I have one comment:
...
+ try:
+ self.assertEqual([], progress.updates)
+ except AssertionError:
+ self.assertEqual(expected,
+ progress.updates)
return lines
^- This looks really bad to me. I would rather see:
if progress.updates not in ([], expected):
self.fail()
Or
if progress.updates != expected:
self.assertEqual([], progress.updates,
'progress.updates should either have no updates or all updates'
'\nexpected: %s\nactual: %s'
% (expected, progress.updates))
Or something like that.
Catching the AssertionError is the wrong way to do it.
To me, 'assertEqual()' is just a helper that has a nice default error
message which includes the things being compared.
So with some sort of fix that doesn't catch AssertionError, +1 from me.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060925/81a73d30/attachment.pgp
More information about the bazaar
mailing list