[darcs-users] making add/remove file commute with content change

Ben Franksen ben.franksen at online.de
Tue Nov 27 18:49:32 UTC 2007


Ketil Malde wrote:
> Ben Franksen <ben.franksen at 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



More information about the darcs-users mailing list