]>
Tony Duckles's Git Repositories (git.nynim.org) - dotfiles.git/blob - bin/svn-wrapper
   2 # Wrapper script around SVN to support using $PAGER and other handy tools. 
   8 # for Solaris, use GNU versions of core utils 
   9 if [ "$UNAME" = SunOS 
]; then 
  10     test -x /usr
/gnu
/bin
/sed  && SED
="/usr/gnu/bin/sed" 
  11     test -x /usr
/xpg
4/bin
/sed  && SED
="/usr/xpg4/bin/sed" 
  16   black
='\e[0;30m';  lblack
='\e[1;30m' 
  17   red
='\e[0;31m';    lred
='\e[1;31m' 
  18   green
='\e[0;32m';  lgreen
='\e[1;32m' 
  19   yellow
='\e[0;33m'; lyellow
='\e[1;33m' 
  20   blue
='\e[0;34m';   lblue
='\e[1;34m' 
  21   purple
='\e[0;35m'; lpurple
='\e[1;35m' 
  22   cyan
='\e[0;36m';   lcyan
='\e[1;36m' 
  23   grey
='\e[0;37m';   lgrey
='\e[1;37m' 
  24   white
='\e[0;38m';  lwhite
='\e[1;38m' 
  42   # ------------------- # 
  43   # `main' starts here. # 
  44   # ------------------- # 
  47   # Define colors if stdout is a tty. 
  49   test "x${PAGER}" = "xmissing" && PAGER
=cat 
  58   s@^?\\(......\\)+@+\\1+@ 
  59   s@^?\\(......\\)\\(.*/\\)+@+\\1\\2+@ 
  60   s@^?\\(......\\),@,\\1,@ 
  61   s@^?\\(......\\)\\(.*/\\),@,\\1\\2,@ 
  62   s/^\\(.\\)C/\\1${lred}C${std}/ 
  65   s/^?/${lblue}?${std}/;  t 
  66   s/^M/${lgreen}M${std}/;  t 
  67   s/^A/${lyellow}A${std}/;  t 
  68   s/^X/${lblue}X${std}/;   t 
  69   s/^+/${lyellow}+${std}/; t 
  70   s/^D/${lyellow}D${std}/; t 
  71   s/^,/${lred},${std}/;    t 
  72   s/^C/${lred}C${std}/;    t 
  73   s/^I/${purple}I${std}/;  t 
  74   s/^R/${lyellow}R${std}/;   t 
  75   s/^!/${lred}!${std}/;    t 
  76   s/^~/${lwhite}~${std}/;  t" 
  78 svn_log_delim
="------------------------------------------------------------------------" 
  81   sub(/^[ \t]+/, "", str); 
  82   sub(/[ \t]+$/, "", str); 
  85 /^r[0-9]+ \| [A-Za-z(]+/ { 
  89   revnum=strip($1); author=strip($2); date=strip(substr($3, 0, 26)); 
  92   if ($0 == "Changed paths:") { 
 101   while ($0 != "'${svn_log_delim}'") { 
 104   if (msg == "'${svn_log_delim}'") { 
 107   printf("'${yellow}'%s'${std}' %s '${lblack}'(by %s, %s)'${std}'\n", revnum, msg, author, date); 
 112   if (substr(str,1,1) == "@") { str = sprintf("'${lpurple}'%s'${std}'", str); } 
 113   if (substr(str,1,1) == "-") { str = sprintf("'${lred}'%s'${std}'", str); } 
 114   if (substr(str,1,1) == "+") { str = sprintf("'${lgreen}'%s'${std}'", str); } 
 115   if (substr(str,1,1) == "=") { str = sprintf("'${lblue}'%s'${std}'", str); } 
 116   if (substr(str,1,1) == "I") { str = sprintf("\n'${lblue}'%s'${std}'", str); } 
 122     exec svn 
"$@" | $PAGER 
 125     exec svn 
"$@" | awk "${awk_svn_diff}" | $PAGER 
 128     exec svn 
"$@" | $PAGER 
 131     exec svn 
"$@" | $PAGER 
 135     exec svn log 
--stop-on-copy "$@" | awk "${awk_svn_log_ll}" | $PAGER 
 138     exec svn 
"$@" | $PAGER 
 141     exec svn 
"$@" | $SED "$sed_svn_st_color" | $PAGER 
 148 # vim: ts=2 sts=2 shiftwidth=2 expandtab