[darcs-users] darcs patch: code clarification (and 1 more)
droundy at darcs.net
Wed Oct 29 17:25:05 UTC 2008
On Tue, Oct 28, 2008 at 08:46:27AM +0100, Christian Kellermann wrote:
> * Reinier Lamers <tux_rocker at reinier.de> [081028 00:55]:
> > Have you looked at co_slurp to create one slurpy instead of checking two
> > slurpies? That's what the code in Darcs.Repository.Internal does when it
> > checks the current repository state.
> I am not sure whether I understand what co_slurp does.
> co_slurp :: Slurpy -> FilePath -> IO Slurpy
> It takes a slurpy and a filepath to get me what? The co_slurp_helper
> confuses me, especially this:
> case efs of
> Right fs
> | isDirectory fs || (isSymbolicLink fs && d' == ".") ->
> do sl <- unsafeInterleaveIO
> $ unsafeInterleaveMapIO (co_slurp_helper fn') c
> return $ Just $ SlurpDir d Nothing $ catMaybes sl
> _ -> return Nothing
> Could you elaborate on your idea behind this suggestion?
co_slurp uses the input slurpy to decide what files (and directories)
to slurp, other than that it's just like slurp. It was originally
introduced to avoid a slowdown that was happening in a colleague's
repository who had millions of files in subdirectories of the working
directory. Darcs was taking forever slurping the working directory,
since it was reading those directories and then ignoring them.
co_slurp is always faster than slurp and is safe as long as you're
not interested in files or directories that might be in the second
directory but not in the input slurpy.
More information about the darcs-users