[BUG] Getting an empty knit tries to put

Aaron Bentley aaron.bentley at utoronto.ca
Mon Apr 3 14:03:36 BST 2006

Hash: SHA1

Robert Collins wrote:
>>If that is the case, I think an attempt to get a VersionedFile that
>>doesn't exist should throw.  But I think it would be a lot nicer if we
>>could return an empty versionedfile without having to make it exist on
>>physical storage first.
> A readonly empty versionedfile would be doable, but ... why ?

It's actually a rather common idiom to say "if it wasn't there, pretend
it was there but empty."  An example would be

print {"me":"you"}.get("them", "")

That is the idiom that get_weave_or_empty looks like it's intended to
support.  I.e. "If there's no signature list, pretend there's an empty
signature list".  The list would, of course, be created on the first write.

> VersionedFile has that api - its VersionedFileStore that is causing the
> write request, and thats because get_weave_or_empty was called.

If that's intended behaviour, I'd prefer a name like get_or_make_weave().

> then no write attempts will be made, and instead it will fail with
> NoSuchFile

And then we will have to pretend, on a higher level, that there is a
signature knit, but it is empty, right?

Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


More information about the bazaar mailing list