Skip to main content

Posts

Showing posts with the label command line

Emptying an entire CVS directory tree

Another one on CVS. Keeping old projects in which one would spend so much effort to do a full migration to another version control system than just learn to live with the CVS limitations makes you find some weird workarounds... In CVS you can't rename a directory, you can't either remove a directory. Instead, you can remove all files in the directory tree you want to remove, and do a "CVS update -P" pruning empty directories. So, how to easily empty an entire directory tree? The find has a "-not" operator which lets you make an inverse logic. For example, you can find -name CVS to locate the CVS control directories and find -not -name CVS to find files other than the CVS control directories. Finally, to empty an entire directory, but not touching the CVS control files and folders, one could run the following line: find . -not -name CVS -a -not -name Entries -a -not -name Root -a -not -name Repository -not -type d | xargs rm; cvs remove

Adding multiple files to CVS

Since the beginning, this blog was meant more as short mental notes for future retrieval. So, here comes another one: I am a long term CVS users. I have lots of old projects which still being maintained with CVS for version control, backup and central repository. Most of these projects must be updated and/or must have new features added to them, some times I have to add lots of files to the repository, and doing this from the command line would be very painful if there were not powerful command line tools such as "find", "grep", "cut" and "xargs". First, I have to add everything which is not a CVS control folder to the repository: find . -not -name CVS -not -name Root -not -name Entries -not -name Repository -exec cvs add {} \; Second, the remaning files from the projects root folder must be added to. Issuing a "cvs update", the appear with a question mark (?), but cvs echos a lot more info to the stderr. We can cut that off, re...