[BUG] Getting an empty knit tries to put

Robert Collins robertc at robertcollins.net
Tue Apr 4 00:04:50 BST 2006


On Mon, 2006-04-03 at 09:03 -0400, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> 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?

Thats why I'm suggesting our bootstrap knits - revision and signature -
are created when the repository is. So theres no pretence needed.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060404/77685501/attachment.pgp 


More information about the bazaar mailing list