Understanding Darcs/Making changes

record makes new stuff old
The record command takes the changes which only exist in your working directory (or the pending patch) and updates the pristine tree. The result of a record operation is a new patch.



replace for renaming tokens
The replace command is useful for explicitly telling darcs to replace one word with another (for example, a variable name, if you are a programmer).

Note that because of the underlying patch theory, replace only works if the new word doesn't already exist in the file. Darcs will helpfully let you know if you try to replace something you cannot. Also, there is a switch for forcing the replacement, but the resulting patch is not a clean darcs-replace patch, but a combination of that, and what you would have gotten if you had edited the file in a text editor. In short, forcing darcs to replace when it really doesn't want to can lead to counter-intuitive results.

Playing with files
We saw add in the last chapter. What about the other file-related commands?

add tells darcs to pay attention
add, unsuprisingly, adds a file or directory to the list of files that darcs is paying attention to.



mv for moving or renaming
mv lets you rename a file or put it in a different directory. This command updates the pending patch with a move command.

you don't need remove
You might think that remove gets rid of a file, but actually all it does is to remove it from the list of files that darcs is paying attention to. You probably just want to delete the file instead (eg: with rm). Darcs will notice and record the change next time you darcs record that file. So what's the remove command good for? It might be handy if you want to just remove the file from darcs, without actually getting rid of your physical copy. This is most useful when you've accidentally used darcs add on a file you don't want darcs to pay attention to.