Print Color-Coded SVN Status

I’ve been having difficulty in reading SVN status, which tells you which files in a project have been modified, added, or having a conflict with other developer’s changes. Status code in front of each line alone doesn’t help me quickly identifying one status code from another so I wrote a script to color code the lines with different colors according to their statuses. If you’re having the same issue, feel free to use the code below :)

#!/usr/bin/python
"""
 Author: Saophalkun Ponlu (http://phalkunz.com)
 Contact: phalkunz@gmail.com
 Date: May 23, 2009
"""


import sys, os, re

# add more status & color codes
colors = {
    "M": "31",      # red
    "\?": "32",     # green
    "C": "30;41"    # black on red
}

# build a paramter list
parameters = "";
for i in range(1, sys.argv.__len__()):
    parameters += sys.argv[i] + " ";

status = os.popen('svn st ' + parameters);
for line in status:
    passed = False
    # remove newline character from the line
    line = re.sub("\n", "", line)
   
    for color in colors:
        match = re.match(color+(" "*6), line)
        if match:  
            os.popen("echo '\E[" + colors[color] + "m" + line + "\E[m'", 'w')
            passed = True
    if(passed):
        continue
       
    os.popen("echo \"" + line + "\"", 'w')

List All The Commits By A Specific Author

From time to time, I want to see what changes I have committed to a project that I work on. The following is a shell command for doing so.

svn log | grep "author_name" | awk '{print "svn log -"$1}' | bash

Webstock’09

webstock'09 name tag

Today, I had a chance to go webstock (web conference & workshop) for the first time. Overall, it was good even though it wasn’t as great as I expected. The talks were given by famous speakers from different countries, well mainly from US and UK. There were 9 speakers today and I liked the talks from 2 speakers the most. Derek Powazek talked “The Wisdom of Communities” and Matt Biddulph talked about “Made of Messages“. Tomorrow is the last day of Webstock ‘09. Look forward to it :)

Silverstripe Site Revamp

silverstripe sites

Yay! New Silverstripe sites went live yesterday, not just one but two (http://silverstripe.com & http://silverstripe.org) at a time :) By the way, I’ve been working for Silverstripe for 5 months and enjoying my time there. Silverstripe is a company that makes an award winning and kick-ass open source PHP web development framework and CMS (Content Management System).  

Widget:GoodShelf For GoodReads

I just finished writing a wordpress widget that grabs a list of books from GoodReads (book readers social network) and I’d like to share it with whoever needs it :) If you want to use this widget you have to use Wordpress and of course have a GoodReads account.�

Features

  • Choose any shelf that you want to display
  • There are 16 sorting options
  • Choose one of the 3 book cover sizes
  • Show or hide book title
  • Set the length of book title
  • Show or hide author name, isbn, user rating, and average rating
  • You can also change the display labels for�author name, isbn, user rating, and average rating

Download

GoodShelf (1593)

Installation

To install it, simply unzip the download file and move/copy�goodshelf.php�to�/wp-content/plugins�folder of wordpress. In the admin page, go to Plugin and activate the GoodShelf plugin.�After that, you need to configure to get it working. Go to Design or Presentation and select GoodShelf. There is a list of options (mentioned in Features) that you can choose from.�The final step is go to Widget to add GoodShelf widget to your sidebar.�

Customization

If you like to customize the widget, below is a list of CSS classes and id associated with the widget that you can style:

  • Book list: .goodshelf_ul
  • Book item: .goodshelf_li
  • Book cover: .goodshelf_cover
  • Book description: .goodshelf_text
  • Profile link: #profile_link