posted by Carlos Leonhard Woelz on Fri 20th Feb 2004 07:29 UTC

"Learning CVS, Page 7/7"
Adding and Removing Files

CVS only recognize files as part of the working directory after you tell CVS explicitely to do so. This is a smart policy, because there are a wide range of automatically generated files, like backups, binary files resulting from a build process, etc... that should not be uploaded with the sources, because they are easily generated derivatives. So let's suppose you created or copied a new file to your working folder: first you have to add it to the positive list of files CVS will not ignore. Than you can commit it. Likewise, to remove a file from the repository you shouldn't only delete it, since CVS will create it again on the next update! You have also to tell CVS to remove it from the repository. The specified files will be removed only after you commit them.

It is also important to keep in mind that CVS was designed to handle text files. Many features, like revision merging, creating differences in a readable form, etc... are only performed to text files. This does not mean you cannot use CVS to keep binary files, it just means you have to tell CVS it is a binary file, otherwise the file may get corrupted.

To add files in a module / working folder to the repository, do the following actions.

- Click the "File" menu then the "Open Sandbox..." menu item.
- Select a working folder / module in the file dialog.
- Select the files you want to add. Note that the add command is not recursive.
- Click the "File" menu then the "Add to repository..." menu item, if the files are text files or "Add binary..." if they are binary files.
- The Add Dialog will pop up.
- Click OK.
- Now you have to commit these files to the repository, to actually add them.

To remove files in a module / working folder and in the repository, it is almost the same:

- Click the "File" menu then the "Open Sandbox..." menu item.
- Select a working folder / module in the file dialog.
- Select the files you want to remove.
- Click the "File" menu then the "Remove from Repository..." menu item.
- The Remove Dialog will pop up.
- Click OK.
- Now you have to commit these files to the repository (using the method described above) to actually remove them.

Conclusion

As you can see, working with CVS is not hard at all. There are a few unintuitive concepts, like handling differently text and binary files and having to perform a two steps operation to add and remove files, but that's all.

And Cervisia makes it even simpler, by adding nice interfaces to checking out files, viewing differences, resolving conflicts and checking the status of the files in the working folder.

The author want to thanks the contributions of Gary Cramblitt, author of the "Building the KDE Source Newbie Guide" and the corrections of Christian Loose, Cervisia maintainer.

About the Author:
Carlos Leonhard Woelz is a Quanta Plus sponsor, and is currently involved with the KDE Quality Team, a program to improve the level of quality of KDE applications by lowering the barriers to contribute to the project and consequently attracting new contributors, developers and non developers.

Table of contents
  1. "Learning CVS, Page 1/7"
  2. "Learning CVS, Page 2/7"
  3. "Learning CVS, Page 3/7"
  4. "Learning CVS, Page 4/7"
  5. "Learning CVS, Page 5/7"
  6. "Learning CVS, Page 6/7"
  7. "Learning CVS, Page 7/7"
e p (0)    25 Comment(s)

Technology White Papers

See More