Getting rid of RootEntry?

Martin Pool mbp at sourcefrog.net
Wed Jan 18 02:01:58 GMT 2006


On 16 Jan 2006, Aaron Bentley <aaron.bentley at utoronto.ca> wrote:

> While working on the Transactional Tree Transform, I figured out a
> pretty easy way of moving the tree root.  That is, turning the tree root
> into a subdirectory.

That's good.

> I believe it's working perfectly, but it breaks diff and status, because
> it causes a file type change; RootEntry has a file type of "root
> directory", but after the move, its type is "directory".
> 
> I think there are three ways to handle this:
> 1. Get rid of RootEntry, and have the the root entry be an
> InventoryDirectory with no parent or name.
> 2. Change the file type of RootEntry to "directory"
> 3. Make it legal for files to change type
> 
> My natural inclination is the first, because I don't see much advantage
> in making the root entry a special type.  Any thoughts?

#1 sounds reasonable to me.  It looks like not much else in the code
cares about the type of it and 

There are some other flaws there in how the root entry is handled: it's
returned by iter(Inventory) but not Inventory.iter_entries.  If we take
this path perhaps we should always return it along with other files and
expect callers to handle it.  I wouldn't change the existing methods'
behaviour but perhaps we can at least decide how to do it for new ones.

We can do #1 now and perhaps #3 later.

-- 
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060118/6dc7e858/attachment.pgp 


More information about the bazaar mailing list