back to notes

Revision Control Tips and Tricks (using RCS)

Print a list of all the files in the current dir that are under RCS revision control:

    rlog -Rb * 2>/dev/null

With headers (showing locks):

    rlog -hb * 2>/dev/null

Alias ('rshow') to do the same, but just print filenames:

    alias rshow='for file in `find . -maxdepth 1 -type f`; do if rlog -hb "$file" >/dev/null 2>&1; \
    then echo "$file"; fi; done'

Print a list of files in the current dir that are checked out to $USER (alias 'rlocks'):

    for file in `find . -maxdepth 1 -type f`; do if rlog -hb "$file" 2>/dev/null | \
    grep -q $USER; then echo "$file"; fi; done

Print a list of files with uncommited changes (alias 'rchanges'/'rch'):

    alias rchanges='for file in `rshow`; do if ! rcsdiff "$file" >/dev/null 2>&1; then echo "$file"; fi; done'

Check if a file is/isn't locked (alias 'islocked')

    alias islocked='check_if_file_list_locked'
    function check_if_file_is_locked() {
        # Check to see if the file exists, dummy:
        if [ ! -f "$1" ]; then
            echo "ACK! That file ('$1') doesn't even exist. Maybe you meant something else." >&2
            return 1
        fi

        if rlog -hb "$1" 2>/dev/null | grep -q $USER; then
            echo "GOOD NEWS: Yep, "$1" is locked by you, $USER."
            return 0
        else
            echo "WHOA, you DON'T have a lock on "$1", $USER!" >&2
            return 1
        fi
    }


last updated april 2013