[darcs-devel] Darcs-git pulling from the Linux repo: a Linux VM question

Ian Lynagh igloo at earth.li
Wed Apr 27 08:36:52 PDT 2005


On Wed, Apr 27, 2005 at 05:12:06PM +0200, Juliusz Chroboczek wrote:
> 
> > If, as I suspect, this is a separate hunk of code then you might want to
> > look at how the (remote) get command works (in d-u).
> 
> Do you mean this?
> 
>   apply_patches ... $ reverse $ concat local_patches
> 
> I must be missing the magic...

The magic is that local_patches is being lazily read (by
lazily_read_repo IIRC). (that reverse looks like one of the things that
still want tidying up; it's not as bad as it looks because we know each
file contains exactly one patch, so we don't have to actually complete
the reads before reversing).

> > I don't know how the git stuff differs from the native darcs stuff
> > to know how directly this can be translated.
> 
> I'm being very naive right now: I walk the two Git trees in parallel,

Which you should be able to do in space linear in the depth of the
directory tree.

> passing any file that has changed to Diff.diff_files, thus building a
> Darcs patch.  Then I push this patch to the higher layers of Darcs.

And, with appropriate unsafeInterleaveIOing of the remaining work to be
done, the patches you get by diffing files should be being immediately
consumed by apply, or the file writing, or whatever it is you're doing
with them. If you're doing more than one thing with them then that's
going to cause problems as you'll hold on to the data. In record this is
handled by writing to the file first, then reading it in again as we
apply to current.

(actually, I think the lazy slurpy building in SlurpDirectory is
actually closer to what you are doing than lazily_read_repo is).


Thanks
Ian





More information about the darcs-devel mailing list