1. Marcin Kasperski
  2. script-cvs_support

Overview

HTTPS SSH

CVS helpers

https://drone.io/bitbucket.org/Mekk/script-cvs_support/status.png

I maintain here a few scripts, which make using CVS slightly less painful (still, if you use CVS, try cvs2hg as soon as possible).

Scripts

cvslistbranches

List all branches in current directory:

cvslistbranches

or in given files:

cvslistbranches blah.hxx blah.cxx

Example output:

* Branches list:
fix_1-14
fix_1-21
fix_1-0-9

* Details
fix_1-14
rel_1-21
    checkout.cxx (1.173.2.1)
rel_1-0-9
    Makefile (1.1.2.1)
    startup.cxx (1.1.2.1)
    startup.hxx (1.96.4.1, 1.96.2.1)
    calc.cxx (1.1.2.1)

cvslisttags

Just list tags in current directory:

cvslisttags

to make it faster, limit to selected files:

cvslisttags Makefile main.cxx

Example output:

rel_1-76-4
rel_1-76-3
rel_1-76-2
rel_1-76-1
rel_1-76-0
rel_1-75-4
rel_1-75-3
rel_1-75-2
…

cvsadd

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

cvsmv

Missing move operation:

cvsmv old_name.txt new_name.txt

or also:

cvsmv olddir/sth.cxx newdir/sthelse.cxx

or even:

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).

cvsrm

Slightly better cvs rm, which handles subdirectories:

cvsrm this.cxx and/that.cxx and/also/that.cxx

and removes the file if present:

cvsrm some_existing_file.cxx

cvsrevert

Reverts given file(s) to last commited version:

cvsrevert something.hxx something.cxx

Preseves .orig files just like Mercurial does.

cvscat

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

cvsvisdiff

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.

Example usages:

  • show uncommited changes:

    cvsvisdiff
    
  • 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
    

Requirements

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

Installation

Clone this repository:

hg clone https://bitbucket.org/Mekk/script-cvs_support  cvs_support

then run:

perl install.pl

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…

History

See HISTORY.txt

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.