Well, you could do it in the exporter code, though it is a bit of an abstraction violation. Something like:
revisions_to_mtimes = {}
for ie in inventory:
mtime = revisions_to_mtimes.get(ie.revision, None)
if mtime is None:
mtime = tree.get_file_mtime(ie.file_id)
revisions_to_mtimes[ie.revision] = mtime
It's bad because tree could be a WorkingTree which doesn't work this way.
I feel it is a little bad for RevisionTree.get_file_mtime() to be peeking at other Revision objects, which at least hints to me that maybe we should be using a different api in general.
The problem is that I think the cache lifetime should be managed by the export api, but the actual caching seems like it should happen underneath RevisionTree.get_file_mtime. (By RevisionTree or by Repository)
I wonder if we would want to move this sort of information into the Inventory (in the future). That would let us record the last modified time as part of commit.
Anyway, I would probably just change the RevisionTree.get_file_mtime() to cache the Revision objects for the lifetime of a lock. We might also want to test that it will, indeed, be an issue during export, but from what I can tell, it seems like it would.
Well, you could do it in the exporter code, though it is a bit of an abstraction violation. Something like:
revisions_to_mtimes = {} to_mtimes. get(ie. revision, None) file_mtime( ie.file_ id) to_mtimes[ ie.revision] = mtime
for ie in inventory:
mtime = revisions_
if mtime is None:
mtime = tree.get_
revisions_
It's bad because tree could be a WorkingTree which doesn't work this way.
I feel it is a little bad for RevisionTree. get_file_ mtime() to be peeking at other Revision objects, which at least hints to me that maybe we should be using a different api in general.
The problem is that I think the cache lifetime should be managed by the export api, but the actual caching seems like it should happen underneath RevisionTree. get_file_ mtime. (By RevisionTree or by Repository)
I wonder if we would want to move this sort of information into the Inventory (in the future). That would let us record the last modified time as part of commit.
Anyway, I would probably just change the RevisionTree. get_file_ mtime() to cache the Revision objects for the lifetime of a lock. We might also want to test that it will, indeed, be an issue during export, but from what I can tell, it seems like it would.