[prev in list] [next in list] [prev in thread] [next in thread] 

List:       darcs-users
Subject:    [darcs-users] [Fwd: Re: making add/remove file commute with content
From:       Richard Giraud <richardg () richardg ! name>
Date:       2007-11-27 21:12:05
Message-ID: 474C8825.1050701 () richardg ! name
[Download RAW message or body]

I find this idea very interesting.  It reminds me a lot of lazy 
evaluation: the existence and state of a file is lazily evaluated each 
time the repository is refreshed.

The following captures the semantics of how I see it (I think).

{{{
  data DarcsFile
  type Patch = Maybe DarcsFile -> Maybe DarcsFile

  applyPatches :: [Patch] -> IO (Maybe DarcsFile) -> IO (Maybe DarcsFile)
  applyPatches ps imdf = foldl applyPatch df ps

  applyPatch :: IO (Maybe DarcsFile) -> Patch -> IO (Maybe DarcsFile)
  applyPatch imdf p = liftM p imdf
}}}

-------- Original Message --------
Subject: Re: [darcs-users] making add/remove file commute with content 
change
Date: Tue, 27 Nov 2007 19:49:32 +0100
From: Ben Franksen <ben.franksen@online.de>
To: darcs-users@darcs.net
References: <fifi9b$jah$1@ger.gmane.org> <87tzn7pmwq.fsf@nmd9999.imr.no>

Ketil Malde wrote:
> Ben Franksen <ben.franksen@online.de> writes:
> 
>> *darcs should allow to record changes to the content of a file that has
>> been removed (or wasn't even added in the first place)*
>   [...]
>> What do you think?
> 
> I'm no darcs expert, so perhaps that is why I am confused.

I am neither so I might have overlooked a semantic problem that lies hidden
in my proposal somewhere.

> What would it mean to pull a change to a file that doesn't exist?

Let me introduce some preliminary terminology. We add two new atomic
changes 'remember file' and 'forget file'. The old semantics for 'add file'
corresponds to the new 'remember file; add file', the old 'rm file'
corresponds to the new 'rm file; forget file'. The new semantics for add
and rm are: 'add file' places the file in your source tree, i.e. flags it
as 'existing'. 'rm file' merely removes the flag.

So, your file gets changed. You won't see it in your source tree, though,
unless you also pull the 'add file' change (assuming it exists in the other
repo).

> What does my repo look like afterwards?

Your repo will know about this file (if it didn't already) but it won't
appear in your source tree.

> If I then pull a patch that 
> creates the file, what will change?

If the patch only adds the file without changing its content, the file will
become visible in your source tree with the (previously hidden) content. If
the patch also places new content in the file (different from the 'hidden'
version, perhaps empty) you should get a conflict w.r.t. the contents of
the file.

> Don't know if this is related, but I think it was once proposed that
> new files would be created ..uh..somewhere else, with a unique name,
> and 'darcs mv'ed into place.  This would let you have different files
> with the same name at different times.

Seems related. See also the _attic subdirectory work-around mentioned by
Petr.

Cheers
Ben

_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users

_______________________________________________
darcs-users mailing list
darcs-users@darcs.net
http://lists.osuosl.org/mailman/listinfo/darcs-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic