tags:

views:

557

answers:

1

I'm looking for a script which takes a working copy of a CVS module, performs any necessary "cvs add" and "cvs remove" commands, and commits everything. The end result is that the repository copy becomes exactly like the working copy.

I think I've seen something like this before, but I couldn't find it on Google. Does anyone have a similar script that they've used? I know I can run "cvs -nq update" and parse the results myself, and that's what I'll probably end up doing. But CVS has all sorts of weird edge cases, so I'd like to find an already-tested script if it exists.

+1  A: 

I wrote something similar as a macro for WinCvs that still comes bundled with it. You can find it under Macros|CVS|Copy to branch/trunk...

It will prompt you for a branch name to copy the current selection to (just leave blank if you want it copied to the trunk) and then makes all the necessary preparations you mentioned except for the final commit.

I only used it in practice a couple of times myself but it has been out there for a couple of years now and I haven't had any complaints...

From the docstring:

======
Usage:

  • Select one or more CVS-controlled files or folders.

  • Run the macro from the Macros|CVS menu.

  • Enter the name of the branch you want to copy the selection to or just hit OK if you want to copy to HEAD.

=============
Known Issues / "Un-niceties":

  • When copying individual files that were added on a branch the automatic adding will not work as CVS will assume the tag of the directory which would be incorrect (this results in a "foo.txt added independently by a second party" error message). It's usually better to always use the macro on directory selections.

  • An update -P in a .cvsrc file could potentially mess up recreation of folders added on a branch, so I explicitly disable use of .cvsrc and set compression fixedly to -z7 (reasonable IMO). All other .cvsrc options will be lost.

Oliver Giesen