[darcs-users] darcs patch: make reading the pending lazy in summary mode
David Roundy
droundy at darcs.net
Sat Apr 26 11:22:44 UTC 2008
On Fri, Apr 25, 2008 at 08:09:59AM -0700, Jason Dagit wrote:
> Warning: I'm not 100% sure that this should be applied, see below.
>
> This might be a fix for Issue814. It skips a read of pending when
> in summary mode. Since not all reads of pending are skipped I don't
> think the problem is that reading pending is too strict, but there
> is definitely some unwanted strictness here. I suspect it's a
> problem with what we do after getting the pending patches.
>
> All tests pass, but I'm worried that in some corner cases of
> 'darcs whats -s' that pending changes could be reported
> incorrectly. Maybe someone could look this over and turn it
> into a real fix for Issue814?
>
> Thanks,
> Jason
>
> Fri Apr 25 00:49:07 PDT 2008 Jason Dagit <dagit at codersbase.com>
> * make reading the pending lazy in summary mode
This looks like a wrong change to me. It may not currently introduce a
bug, but your concerns are correct. At a minimum it introduces a latent
bug that could bite our users if we ever add the --summary flag to any
command that affects our repository. It also changes the behavior of darcs
whatsnew to be less accurate.
> slurp_pending :: RepoPatch p => Repository p -> IO Slurpy
> -slurp_pending repo = do
> +slurp_pending repo@(Repo _ opts _ _) = do
> cur <- slurp_recorded repo
> hunk ./src/Darcs/Repository/Internal.lhs 234
> - pend <- read_pending repo
> + pend <- if Summary `elem` opts
> + then return ( NilFL :: FL Prim)
> + else read_pending repo
> case apply_to_slurpy pend cur of
> Just pendcur -> return pendcur
If we ever add the --summary flag to (for instance) record, push or pull,
this will corrupt repositories. I could easily imagine wanting to see a
summary of each patch that I'm prompted to pull, as if I had hit 'x'. So
no, this is definitely not the way to go.
The real fix for Issue814 is to ignore any changes to newly added files
when doing whatsnew -s, and this change needs to happen in diff. Gwern's
idea of making is_funky faster is always good (since it speeds up many
darcs commands, if only a little), but I don't think it touches the real
problem, which is that we shouldn't be opening these files at all.
--
David Roundy
Department of Physics
Oregon State University
More information about the darcs-users
mailing list