[MERGE] Quicker initial commit
Ian Clatworthy
ian.clatworthy at internode.on.net
Mon Sep 3 02:09:13 BST 2007
John Arbash Meinel wrote:
> John Arbash Meinel has voted tweak.
> In general, I prefer using:
> - return work_tree.get_file(self.file_id).readlines()
> + return work_tree.get_file(self.file_id, path).readlines()
>
> get_file_lines(id, path)
>
> to
>
> get_file().readlines()
>
> I realize in this case they are equivalent. But
> RevisionTree.get_file_lines() is much more efficient than
> get_file().readlines().
>
> get_file().readlines() is actually
> StringIO(''.join(self.get_file_lines())).readlines()
>
> We have the api's, so I think it would be best to have practice using
> the right one. (not a big deal in this circumstance)
As it wasn't a big deal and as get_file_lines() only existed on
RevisionTree and WorkingTree4, I left this as it was. I'm happy to go
and add get_file_lines() + tests to all the other trees in a separate
patch if you want. I don't think it buys us anything right now though in
terms of commit performance.
> Tree.get_file() has undefined behavior when path and id would not point
> to the same object. I'm not sure how to handle this. We should at least
> define whether one has priority, if it is implementation defined, or if
> it should error.
> I'm guessing it is going to be "implementation defined". Since WT
> prefers path, and RT prefers file_id. (Just based on how things are
> stored/accessed.)
> We should at least document it.
Agreed. Done and merged.
Ian C.
More information about the bazaar
mailing list