.bashrc: Make sure $MANPATH has some sane defaults
[dotfiles.git] / bin / svn-wrapper
index 931a51187c2e0ee911fce25f0efe00aaf5399910..f2c3287feb9f8c30fba25c33ffda2cdcd6c8b852 100755 (executable)
@@ -75,9 +75,12 @@ function strip(str) {
   sub(/[ \t]+$/, "", str);
   return str;
 }
-/^r[0-9]+ \| [A-Za-z]+/ {
+/^r[0-9]+ \| [A-Za-z(]+/ {
   in_rev=1;
-  revnum=strip($1); author=strip($2); date=substr(strip($3), 0, 26);
+  FS="|";
+  $0=$0 "";
+  revnum=strip($1); author=strip($2); date=strip(substr($3, 0, 26));
+  FS=" ";
   getline;
   if ($0 == "Changed paths:") {
     while ($0 != "") {
@@ -95,15 +98,24 @@ function strip(str) {
     msg = "";
   }
   printf("'${yellow}'%s'${std}' %s '${lblack}'(by %s, %s)'${std}'\n", revnum, msg, author, date);
-};
-'
+};'
+
+awk_svn_diff='
+{ str=$0;
+  if (substr(str,1,1) == "@") { str = sprintf("'${lpurple}'%s'${std}'", str); }
+  if (substr(str,1,1) == "-") { str = sprintf("'${lred}'%s'${std}'", str); }
+  if (substr(str,1,1) == "+") { str = sprintf("'${lgreen}'%s'${std}'", str); }
+  if (substr(str,1,1) == "=") { str = sprintf("'${lblue}'%s'${std}'", str); }
+  if (substr(str,1,1) == "I") { str = sprintf("\n'${lblue}'%s'${std}'", str); }
+  print str;
+};'
 
 case $1 in
   cat)
     exec svn "$@" | $PAGER
     ;;
   diff)
-    exec svn "$@" | $PAGER
+    exec svn "$@" | awk "${awk_svn_diff}" | $PAGER
     ;;
   help)
     exec svn "$@" | $PAGER
@@ -113,7 +125,7 @@ case $1 in
     ;;
   ll)
     shift
-    exec svn log --stop-on-copy "$@" | awk -F"|" "${awk_svn_log_ll}" | $PAGER
+    exec svn log --stop-on-copy "$@" | awk "${awk_svn_log_ll}" | $PAGER
     ;;
   log)
     exec svn "$@" | $PAGER