On Sun, Nov 17, 2013 at 10:11:06PM -0800, milki wrote:
> > @@ -620,6 +703,10 @@ def __init__(self, root):
> >          refs = DiskRefsContainer(self.controldir())
> >          BaseRepo.__init__(self, object_store, refs)
> >  
> > +        graft_file = self.get_named_file(os.path.join("info", "grafts"))
> > +        if graft_file:
> > +            self.graftpoints = parse_graftpoints(graft_file)
> 
> I leave it in the hands of the user to write the files to disk themselves with put_named_file. They would take the graftpoints and run them through serialize_graftpoints before writing to the file.
> 
> There is no watcher for changes to the grafts file, much like how the object store is only loaded once at the beginning of repo initialization. The run time view of the graftpoints is the source of truth after initialization.
The object store isn't loaded on startup; objects that appear during the
lifetime of the ObjectStore object should still be accessible.

For packs we do do caching, but we check the timestamp on the
.git/objects/packs directory before we actually use the cache. For loose
objects, we just query the file system so we're always up to date.

Anyway, I'm not sure what the best alternative is for grafts. Clearly we don't want to stat
the grafts file for every parent lookup. 

Eventually, I suspect we would like to allow the repository to cache things
like the grafts map for a certain amount of time. For example, it might make
sense to just read the grafts file once per get_walker invocation.

For the moment, I think what you have is good enough but I'll add some warnings
mentioning that this code is still in flux.

Jelmer