[darcs-devel] darcs patch: Don't read tempdir_loc if we don't need it (and 13 more)

David Roundy droundy at abridgegame.org
Fri May 13 04:31:19 PDT 2005


On Fri, May 13, 2005 at 02:49:59AM +0100, Ian Lynagh wrote:
> 
> Slurpy writing is mostly gone. DiffCommand and Resolution are irritating
> as they want things from working, but only those in the repo; plus there
> are the effects of pending to consider. Perhaps the best way is to copy
> pristine and then apply the patch that record --all would or something.

Hmmmm.  I don't quite like that solution, as it requires diffing, which
could be slow.  Couldn't we implement a cloneWorking which would
essentially do something like
  s <- slurpRecorded
  p <- read_pending
  coClone (apply_to_slurpy p s) "." dest

This being very sketchy, but hopefully you'll get the idea.  Ideally we'd
also manage to filter out the replaces from pending--since applying them
would be foolish.  We really just want to apply the move, add and remove
patches.

Perhaps we would instead prefer something like a

   fs <- getRecordedFilePaths
   p <- read_pending
   clonePartial (apply_to_filepaths p fs) "." dest

where again I'm sure I've got arguments out of order and all.  The first
function would of course just read the directory listings.


Another idea (unrelated, except that it also involves DiffCommand) is that
perhaps we could kill two birds with one stone if we implemented an
apply_restricted function that applied only patches matching a certain
criterion.

apply_restricted :: WriteableDirectory m =>
                 (FileName -> Bool) -> Patch -> m ()

This would allow us when constructing trees on which to run diff to only
create the relevant files and directories, and would also help us to
implement the partial-checkout idea that came up on the fptools thread, in
which you only apply patches to certain subdirectories of a repository.
We'd also need more changes to allow only downloading a subset of the
patches in a repository, but this change would also be necesary, since
you'd end up applying patches which also affect stuff that you don't have
in either working or pristine.

The cool thing is that it would be useful just for the diff business
(i.e. running darcs diff -p foobar Foo.hs), which would allow it to be
debugged before working on the partial repository business.  Also, the
other part of the partial repository business (a cache of which patches
affect which files) would also be useful for running diff efficiently, so
the whole infrastructure could be debugged without changing darcs'
behavior.
-- 
David Roundy
http://www.darcs.net




More information about the darcs-devel mailing list