tcsh aliases for working with CVS

I normally want the description of a file inside CVS to be the same as the one-line description early in the comments (for a script) or the Subject header (for a documentation file). If you use my standard documentation format and my standard script header format (the important part being the name of the script, a space, two dashes, a space, and the description on a comment line by itself), these two aliases will pull the description out of the file and give it to cvs add.

    alias cvsadddoc \
        'cvs add' \
        '-m"`perl -ne '\''print,last if s/^ Subject: //'\'' \!:1`" \!:1'
    alias cvsaddscript \
        'cvs add' \
        '-m"`perl -ne '\''print,last if /^# \S+ -- //'\'' \!:1`" \!:1'

which pulls out the first line in the file that begins with whitespace (since the first line in my C programs is an open comment and the Id tag, and the next non-blank line is the short description). For C headers, I use:

    alias cvsaddh \
        'cvs add' \
        '-m"`perl -ne '\''print,last if s%^/\* \S+ -- %% &&' \
            's%\s+\*/\n%%'\'' \!:1`"' \!:1

which gets comments like /* file.h -- Description. */. Syntax for all these commands is just <command> <file>.

These are only useful if you have a policy of always filling in the description line for your files, which can be useful but may also just be noise depending on what tools you use to read your repository and whether you ever use those lines for anything useful. If you don't care about the description lines, a simple cvs add will work fine.

Last spun 2022-02-06 from thread modified 2014-08-17