I maintain here a few scripts, which make using CVS slightly less painful (still, if you use CVS, try cvs2hg as soon as possible).
List all branches in current directory:
or in given files:
cvslistbranches blah.hxx blah.cxx
* Branches list: fix_1-14 fix_1-21 fix_1-0-9 * Details fix_1-14 rel_1-21 checkout.cxx (220.127.116.11) rel_1-0-9 Makefile (18.104.22.168) startup.cxx (22.214.171.124) startup.hxx (126.96.36.199, 188.8.131.52) calc.cxx (184.108.40.206)
Slightly better, directory aware cvs add:
cvsadd include/data.hxx src/data.cxx
(will iterate over directories, adding files, if necessary will create directories itself).
This also works:
cvsadd ../README.txt ../tests/test.cxx
Missing move operation:
cvsmv old_name.txt new_name.txt
cvsmv olddir/sth.cxx newdir/sthelse.cxx
cvsmv file.cxx ../another_dir/
(technically it renames the file, removes old one from CVS, and adds new one there).
It is also possible to move file or many files to new directory:
cvsmv exe/*.cxx lib/
(target directory should already be added to CVS, to reduce accidental mistakes).
Slightly better cvs rm, which handles files from subdirectories:
cvsrm this.cxx and/that.cxx and/also/that.cxx
removes the file if present:
and even is able to remove directory trees:
cvsrm somewhere/prog/ somewhere/lib/
(the latter removes all files found inside given tree).
Reverts given file(s) to last commited version:
cvsrevert something.hxx something.cxx
Preseves .orig files just like Mercurial does.
More intuitive way to print old version to stdout:
cvscat -r 1.17 something.hxx cvscat -r sometag_1-3-0 subdir/readme.txt cvscat -D yesterday item.cxx
Works for printing last commited version too:
cvscat somefile.hxx cvscat subdir/another.cxx
Spawns visual diff (kompare) to show cvs differences.
Specified params are passed on to cvs diff, script wraps the output and opens it in GUI diff tool.
show uncommited changes:
show uncommited changes in given files:
cvsvisdiff blah.hxx blah.cxx subdir/item.hxx
show diff since some tag or version:
cvsvisdiff -r TAG cvsvisdiff -r TAG blah.cxx blah.hxx cvsvisdiff -r 1.19 blah.cxx
compare two tags or releses:
cvsvisdiff -r TAG1 -r TAG2 cvsvisdiff -r TAG1 -r TAG2 *.hxx cvsvisdiff -r 1.18 -r 1.19 blah.cxx
To use those scripts you need reasonably modern Perl, and a few modules (most should be installed together with perl itself, , but Path::Tiny and IPC::System::Simple may need to be installed separately).
cvsvisdiff uses kompare to show diff.
Of course you need cvs itself.
On Debian or Ubuntu the following command should install all dependencies:
sudo apt-get install \ cvs perl libpath-tiny-perl libipc-system-simple-perl kompare
Clone this repository:
hg clone https://bitbucket.org/Mekk/script-cvs_support cvs_support
to create symlinks to scripts in ~/bin/.
Tests (and examples)
There are some self-documenting tests in tests subdirectory.
To run them, you need cram (and some Python). Mayhaps it would make sense to use Test::Output instead, but I like cram…
Source code, issues, patches, suggestions
Official repository is maintained at Mekk/script-cvs_support.
Please use its issue tracker to report issues and suggest changes.
Pull requests are also welcome.