Kicking the little puppies

Back to index...
First published
Mon Nov 30 10:08:27 2009
Last changed
Mon Nov 30 10:08:27 2009

VCS hell

About the biggest productivity boost I've done in long time was putting this into my ~/.bashrc:

  vcs ()
  {
          TOOL=
          [ -d CVS ] && TOOL=cvs
          [ -d .svn ] && TOOL=svn
          [ -d .osc ] && TOOL=osc
          echo "$@" |grep :// && TOOL=$1
          [ "$TOOL" ] || TOOL=$(D=; for C in $(echo $PWD |sed 's,/, ,g')
          do
                  D="$D/$C"
                  echo $D
          done | sort -r |while read DIR
          do
                  [ -d $DIR/.hg ] && TOOL=hg
                  [ -d $DIR/.git ] && TOOL=git
                  [ "$TOOL" ] && echo $TOOL && break
          done)
          [ "$TOOL" ] || TOOL=$1
          shift
          $TOOL "$@"
  }
  alias git="vcs git"
  alias cvs="vcs cvs"
  alias svn="vcs svn"
  alias osc="vcs osc"
  alias hg="vcs hg"

Source code to the entries and scripts that format this site are available on github. Text of journal entries is licensed under CC-BY-SA license.

Mail questions, comments and pizza to lkundrak@v3.sk