]>
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. 
   9   black
='\e[0;30m';  lblack
='\e[1;30m' 
  10   red
='\e[0;31m';    lred
='\e[1;31m' 
  11   green
='\e[0;32m';  lgreen
='\e[1;32m' 
  12   yellow
='\e[0;33m'; lyellow
='\e[1;33m' 
  13   blue
='\e[0;34m';   lblue
='\e[1;34m' 
  14   purple
='\e[0;35m'; lpurple
='\e[1;35m' 
  15   cyan
='\e[0;36m';   lcyan
='\e[1;36m' 
  16   grey
='\e[0;37m';   lgrey
='\e[1;37m' 
  17   white
='\e[0;38m';  lwhite
='\e[1;38m' 
  35   # ------------------- # 
  36   # `main' starts here. # 
  37   # ------------------- # 
  40   # Define colors if stdout is a tty. 
  42   test "x${PAGER}" = "xmissing" && PAGER
=cat 
  51   s@^?\\(......\\)+@+\\1+@ 
  52   s@^?\\(......\\)\\(.*/\\)+@+\\1\\2+@ 
  53   s@^?\\(......\\),@,\\1,@ 
  54   s@^?\\(......\\)\\(.*/\\),@,\\1\\2,@ 
  55   s/^\\(.\\)C/\\1${lred}C${std}/ 
  58   s/^?/${lblue}?${std}/;  t 
  59   s/^M/${lgreen}M${std}/;  t 
  60   s/^A/${lyellow}A${std}/;  t 
  61   s/^X/${lblue}X${std}/;   t 
  62   s/^+/${lyellow}+${std}/; t 
  63   s/^D/${lyellow}D${std}/; t 
  64   s/^,/${lred},${std}/;    t 
  65   s/^C/${lred}C${std}/;    t 
  66   s/^I/${purple}I${std}/;  t 
  67   s/^R/${lyellow}R${std}/;   t 
  68   s/^!/${lred}!${std}/;    t 
  69   s/^~/${lwhite}~${std}/;  t" 
  71 svn_log_delim
="------------------------------------------------------------------------" 
  74   sub(/^[ \t]+/, "", str); 
  75   sub(/[ \t]+$/, "", str); 
  78 /^r[0-9]+ \| [A-Za-z(]+/ { 
  82   revnum=strip($1); author=strip($2); date=strip(substr($3, 0, 26)); 
  85   if ($0 == "Changed paths:") { 
  94   while ($0 != "'${svn_log_delim}'") { 
  97   if (msg == "'${svn_log_delim}'") { 
 100   printf("'${yellow}'%s'${std}' %s '${lblack}'(by %s, %s)'${std}'\n", revnum, msg, author, date); 
 105   if (substr(str,1,1) == "@") { str = sprintf("'${lpurple}'%s'${std}'", str); } 
 106   if (substr(str,1,1) == "-") { str = sprintf("'${lred}'%s'${std}'", str); } 
 107   if (substr(str,1,1) == "+") { str = sprintf("'${lgreen}'%s'${std}'", str); } 
 108   if (substr(str,1,1) == "=") { str = sprintf("'${lblue}'%s'${std}'", str); } 
 109   if (substr(str,1,1) == "I") { str = sprintf("\n'${lblue}'%s'${std}'", str); } 
 115     exec svn 
"$@" | $PAGER 
 118     exec svn 
"$@" | awk "${awk_svn_diff}" | $PAGER 
 121     exec svn 
"$@" | $PAGER 
 124     exec svn 
"$@" | $PAGER 
 128     exec svn log 
--stop-on-copy "$@" | awk "${awk_svn_log_ll}" | $PAGER 
 131     exec svn 
"$@" | $PAGER 
 134     exec svn 
"$@" | sed "$sed_svn_st_color" | $PAGER 
 141 # vim: ts=2 sts=2 shiftwidth=2 expandtab