[MERGE] Fix bug #314525: don't try to put ids if there is no annotation.

John Arbash Meinel john at arbash-meinel.com
Tue Jan 27 15:25:14 GMT 2009


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

Vincent Ladeuil wrote:
> We can't add ids if there is no lines to annotate.
> 
> Anne provided the fix on launchpad, I just lightly adapt it and
> post it here so that it get tracked properly.
> 
>      Vincent
> 
> 

Personally, I would have done:

  if not annotations:
    return

And then you can leave the rest of the code unchanged.

I would be a little concerned that 'annotations' may want to be an
iterator at some point, so it might actually be better to do:

try:
  max_origin_len = max(len(origin) for origin, text in annotations)
except ValueError:
  # No lines, nothing to annotate
  return

Regardless, your fix is fine, just thinking out loud about alternatives.

BB:approve

John
=:->

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

iEYEARECAAYFAkl/J1oACgkQJdeBCYSNAAPNwQCfQjHNuv4Qmk2WNxQA3LmyD7/f
mXMAn1uVHYg162G8RrhsA06sGbP1mWr+
=Kdrp
-----END PGP SIGNATURE-----



More information about the bazaar mailing list