Moving Files or Directories
There is no CVS command designed specifically to move a file or file directory. In fact, CVS’s design doesn’t accomodate such moves. However, you can work around this limitation using a combination of CVS commands, or by altering the repository using operating-system commands. Moving files can make project history difficult to track, because then a file’s history is recorded across two different files in different locations. Minimize this potential source of confusion by recording the new and old locations with meaningful log messages.
Tip
To rename a file or directory at the operating-system level, move it from the old filename to the new filename. For example, use the Unix mv command.
Moving Files
The
recommended way to move a file is to use cvs
remove
followed by cvs add
, with
messages that state where the file was moved from and to. This method
preserves the file’s history and allows reversion to
earlier versions of the project in its old location. However, the
messages stored with the add
and
remove
commands are the only record of the move.
Example 3-19 shows this method being used to rename
the wizzard.h
file.
Example 3-19. Renaming a file
bash-2.05a$mv wizzard.h config.h
bash-2.05a$cvs remove wizzard.h
cvs server: scheduling `wizzard.h' for removal cvs server: use 'cvs commit' to remove this file permanently bash-2.05a$cvs add config.h
cvs server: scheduling file `config.h' for addition cvs server: use 'cvs commit' to add this file permanently bash-2.05a$ ...
Get Essential CVS now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.