Improved CVS Update

Oct 28, 2002 2:33 PM
Tags: bash, cvs, linux, unix
update I've added three more lines, for dealing with additions, removals and messages about CVS itself.

Here, for your enjoyment and confusion is my .emacs file, which I use to customize my editing environment.

And here is a gem from my .bashrc, named for its ancestor, cvs update:
alias cup='cvs -q update -dP | perl -e "
while(<>){
  if(\$_=~/.*\.pyc\$/)          {;}
  elsif(\$_=~/^C\s\S.*/)        {print\"\033[1;31m\".\$_.\"\033[0m\";}
  elsif(\$_=~/^M\s\S.*/)        {print\"\033[1;33m\".\$_.\"\033[0m\";}
  elsif(\$_=~/^cvs\s\S.*/)      {print\"\033[1;34m\".\$_.\"\033[0m\";}
  elsif(\$_=~/^\?\s\S.*/)       {print\"\033[1;32m\".\$_.\"\033[0m\";}
  elsif(\$_=~/^A\s\S.*/)        {print\"\033[1;35m\".\$_.\"\033[0m\";}
  elsif(\$_=~/^R\s\S.*/)        {print\"\033[1;36m\".\$_.\"\033[0m\";}
  else{print\$_;}
}
";'

In a nutshell, it updates your folder from the source repository, removes deleted files and folders, and checks out newly-added ones. Also, the output is colored: green for files that you haven't added to the repository yet, yellow for merges, and red for conflicts. Everything else is in the normal grey color.

This blog is no longer active, and comments have been disabled.