meder omuraliev
meder omuraliev

Reputation: 186562

Recursively CVS add files/directories and ignore existing CVS files

There's a similar post @ How to add CVS directories recursively

However, trying out some of the answers such as:

find . -type f -print0| xargs -0 cvs add

Gave:

cvs add: cannot open CVS/Entries for reading: No such file or directory cvs [add aborted]: no repository

And

find . \! -name 'CVS' -and \! -name 'Entries' -and \! -name 'Repository' -and \! -name 'Root'  -print0| xargs -0 cvs add

Gave:

cvs add: cannot add special file `.'; skipping

Does anyone have a more thorough solution to recursively adding new files to a CVS module? It would be great if I could alias it too in ~/.bashrc or something along those lines.

And yes, I do know that it is a bit dated but I'm forced to work with it for a certain project otherwise I'd use git/hg.

Upvotes: 1

Views: 2603

Answers (3)

Oliver Giesen
Oliver Giesen

Reputation: 9439

See this answer of mine to the quoted question for an explanation of why you get the "cannot open CVS/Entries for reading" error.

Two important things to keep in mind when looking at the other solutions offered here:

  • folders have to be added, too
  • in order to add a file or folder, the parent folder of that item must already have been added, so the order in which items are processed is very important

So, if you're just starting to populate your repository and you haven't yet got anything to check out that would create a context for the added files then cvs add cannot be used - or at least not directly. You can create the "root context" by calling the following command in the parent folder of the first folder you want to add:

cvs co -l .

This will create the necessary sandbox meta-data (i.e. a hidden "CVS" subfolder containing the "Root", "Repository" and "Entries.*" files) that will allow you to use the add command.

Upvotes: 0

Mark Edgar
Mark Edgar

Reputation: 4817

find . -name CVS -prune -o -type f -print0

Upvotes: 1

DVK
DVK

Reputation: 129403

This may be a bit more elegant:

find . -type f -print0 | egrep -v '\/CVS\/|^\.$' | xargs -0 cvs add

Please note that print0, while very useful for dealing with file names containing spaces, is NOT universal - it is not, for example, in Solaris's find.

Upvotes: 2

Related Questions