[darcs-devel] darcs patch: remove dirty flag and IO method from Slurpy.

David Roundy droundy at abridgegame.org
Mon May 16 04:38:29 PDT 2005


On Sun, May 15, 2005 at 02:03:26PM +0100, Ian Lynagh wrote:
> On Sun, May 15, 2005 at 06:43:18AM -0400, David Roundy wrote:
> > We will need to figure out how to make setpref work with apply.
> > Either we need to somehow write a special apply for the IO monad, or we
> > need to add a setpref operation to WriteableDirectory.  Probably the
> > latter, I imagine, since I don't know how to do the former.
> 
> Ah, I hadn't realised apply currently ignores ChangePref. That means
> that currently we can create pristine from the patches and then create
> working from pristine in the get command, with the prefs not being
> created, doesn't it?

Yeah.

> I'm not keen on the idea that apply might throw away ChangePref info if
> it happens to be writing to a slurpy, though. It's the sort of thing
> that might come back to bite us later when someone decides to write a
> slurpy again for some reason.

I don't know, it doesn't seem so bad to me.  We also lose the changepref
info when we apply patches to some arbitrary directory.

> This makes me wonder again about changing the datastructures to:
> 
> data NamedP = NamedP !PatchInfo ![PatchInfo] !Patch ![ChangePref]
>
> data Patch = Move !FileName !FileName
>            | DP !FileName !DirPatchType
>            | FP !FileName !FilePatchType
>            | Split [Patch]
>            | ComP [Patch]
>            | Merger !Bool !String Patch [Patch] Patch Patch
>            | Conflictor Bool [Patch] [Patch]
> 
> data ChangePref = ChangePref !String !String !String

That would be appealing, but of course it breaks backwards compatibility
for what seems like very little gain.

> I don't think I like this, though. If ChangePrefs were more normal (WRT
> conflicts) we could just have a _darcs/prefs in _darcs/current, but
> it's not obvious how to do that either. Ho humm.

Indeed, that might be the way to go.  If ChangePrefs were a "normal" patch,
we could include both old and new prefs.  Alas, changing commutation
behavior is expensive (in terms of breaking existing repositories).  :(

I'd say the "easy" thing to do is to make apply (in IO monad) check if
_darcs/prefs/ exists, and if so run change_setpref (or whatever that
relevant function is called).
-- 
David Roundy
http://www.darcs.net




More information about the darcs-devel mailing list