[RFC] ParentsProvider returning a dictionary instead of a list

Aaron Bentley aaron.bentley at utoronto.ca
Sun Dec 9 20:14:23 GMT 2007


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

John Arbash Meinel wrote:
> At the moment our Graph code expects a parents_provider to return a list, where
> each entry matches up with the requested revisions.

> DictParentsProvider:
>   already has them in a dict, so just does the iteration, depending on how
>   get_parents was defined it could just return it (do we care if there are
>   extra nodes?)

It seems wacky to return stuff that the caller wasn't expecting.  If
you're returning a dict, it would seem natural to iterate through it
with iteritems, and if un-requested stuff is there, the results could be
quite silly.

One of the reasons I originally went with a list was that I wanted to
make it very clear when a requested set of parents was not being
returned (e.g. due to not-present revisions).  How do you plan to
represent that?  Not putting the child revision in the dictionary?
That's easy to miss.  Assigning the value to None?  That's also easy to
miss if you're using dict.get().

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

iD8DBQFHXEyf0F+nu1YWqI0RAmVxAJ99BMmz3j13c7tI5HhHFK/mrQfX1gCeJMCM
+gHaOafggQaHqy3FhkR0E+I=
=8WWY
-----END PGP SIGNATURE-----



More information about the bazaar mailing list