Thoughts on file ids

Jelmer Vernooij jelmer at samba.org
Mon May 9 14:40:38 UTC 2011


On Mon, 2011-05-09 at 16:08 +0200, John Arbash Meinel wrote:
> ...
> >>> The tuples we use for versionedfiles are already repository
> >>> implementation details, aren't they?
> >> They are now, but that's a relatively recent change.
> > 
> > Before now, they were part of the model?
> 
> I'm pretty sure we have code (like with annotate, or 'bzr log file')
> that assumes you can do:
> 
>  file_id = tree.path2id(path)
>  _, ie = tree.iter_entries_by_dir([file_id]).next()
>  revision = ie.revision
>  key = (file_id, revision)
>  texts = tree.branch.repository.texts
>  texts.get_parent_map([key])
>  record = texts.get_record_stream([key]).next()
> 
> etc. (That you can take a file_id you got elsewhere, add it to
> ie.revision to get a key to look it up in the repository.)
We currently only have that sort of code remaining in repository
implementations and utility functions (e.g. bzrlib.annotate.Annotator),
but none of the format-independent code general code (like builtins,
etc) relies on it.

> I don't know exactly where in the code, but we don't have a
> InventoryEntry.get_text_key() that abstracts how to go from an Inventory
> to an actual text that you extract from the repository.
> 
> We might be close to that, though.
I think that would be pretty easy to do - at this point, it should be a
change isolated to InventoryEntry,
InventoryRevisionTree.{annotate_iter,get_file_text}, the per-file log
code and nothing else.

Cheers,

Jelmer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/bazaar/attachments/20110509/9dc464f0/attachment.pgp>


More information about the bazaar mailing list