[BUG] Getting an empty knit tries to put

Robert Collins robertc at robertcollins.net
Sun Apr 2 23:47:22 BST 2006

On Sun, 2006-04-02 at 17:56 -0400, Aaron Bentley wrote:
> Hash: SHA1
> Robert Collins wrote:
> | On Fri, 2006-03-31 at 14:48 -0500, Aaron Bentley wrote:
> |>In KnitVersionedFile.__init__, if self.versions() is empty, it will not
> |>only produce a new knit, but attempt to write it to the transport.
> |
> |
> | Right, this is by design: VersionedFiles exist on a persistent storage
> | place.
> So you're saying a VersionedFile must be a representation of a
> physically stored object?

Yes. This is a corollary to the basis of knits or 'revfiles' if we go
back some while where there is a persistent file that we can mutate, and
the in memory representation is typically just the index.

> 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 ?

> | The bug here is that Repository initialisation is 'lazy' and does not
> | create empty revision, signature knits.
> This is very unexpected behavior to me.  An attempt to read should not
> cause an observable write.  I think we will continue to have this bug
> appear in various places until we provide a readonly-safe API for
> VersionedFile.

VersionedFile has that api - its VersionedFileStore that is causing the
write request, and thats because get_weave_or_empty was called. If we:
 * make the signature and revision files on repo initialisation and
 * change fetch to use get_weave()

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


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/20060403/5c9e1fb0/attachment.pgp 

More information about the bazaar mailing list