Discussing the nuts and bolts of software development

Monday, July 07, 2008


Mining Project Scope with Python + SVN

After developing a component for a fairly large enterprise application, I was tasked with coordinating a complete review of all code touched by our team. As the project involved hundreds of commits across every tier of the application, this was not a trivial task. I didn’t want to make developers hunt through SVN logs and JIRA - even if the result was accurate, producing meta-documentation in the time allotted for actual documentation seemed wasteful. There had to be a way to automate it. After failing to find an appropriate SVN tool via Google, I weighed the pros and cons [1] then decided that using an SVN API would be easy enough.

To make it interesting As part of my commitment to Macadamian’s core value of continual improvement, I decided to try out Python. The following script was maybe an hour of entertaining work that saved at least a day of tedium.

import pysvn

# Script variables. Could be read from a command line or config. file.
username = "jlennon"
password = "yoko"
projectFirstRevision = 103991
svnRoot = "http://path/to/svn/trunk/"

# Team members’ names for SVN commits.
users = set([

# Set up SVN callbacks.
def get_login(realm, username, may_save):
return True, username, password, False;

def get_log_message() :
return True, "log message called"

client = pysvn.Client()
client.callback_get_login = get_login
client.callback_get_log_message = get_log_message

# Convert the revision number into a pysvn revision.
projectFirstRevision = pysvn.Revision(pysvn.opt_revision_kind.number, projectFirstRevision)

# Get all commits since the project's first commit.
items = client.log(

# Set up variables for storing commit information
allPaths = set([])
removedPaths = set([])

# For each commit entry *made by one of this project's users*
# Add any deleted files in the commit to removedPaths
# Add any added/updated files to the list of all paths
for item in [ e for e in items if e.author in users ]:

for changed_path in item.changed_paths:

if changed_path.action == "D":

# Remove deleted files from allPaths, then display
allPaths = allPaths - removedPaths

for path in sorted(allPaths):
print path

Overall, I was impressed by Python. My biggest problem was with the structure of the documentation, but that’s to be expected with any new language. My biggest surprise was that the indentation rules didn’t bother me – why is this cited as a show-stopper by so many developers? I’ll definitely be coming back to Python to test its OO facilities.

[1] The main con being that a developer would much rather write a neat SVN spider than write documentation. In a leadership role, you have to think twice before eagerly firing up your compiler to solve a problem.

Nice code, You`re doing well!
Your post was very helpful, I clearly understood the topic.
Thank you for the information, i found the information very useful.
If anyone looking for Python programming training in Bangalore i suggest Apponix Technologies, they provide best Python Programming training. For more information visit : https://www.apponix.com/Python-Institute/Python-Training-in-Bangalore.html


AllAssignmentHelp.com. Based on the opinions of the students, we are sharing a review on Allassignmenthelp reviews. Also, we will be sharing some of the student’s comments on the same.

Excellency is something whose expectation has been wished by all Ph.D. graduate students. It does not matter you are pursuing you post-graduation in which subject stream. One should urge to assignment help the online team so that their homework is not in the impartial stage. assignment help
Woah! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “ perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this. assignment help online
Do you want to know more about a sociology major? I have something for you!
Getting the best college essay writing services online is one of the easiest ways to get high grades in your academics. Know more about Essayassignmenthelp.com.au to get urgent essay help in Australia. Our efficient experts who provide paper editing services maintain the credibility of your paper with their top-notch services. Hire our paper proofreaders.
Our team of professional writing services is immensely versatile. They don’t restrict themselves to only one kind of paper content writing. They can even deliver cheap essay writing help services with equal ease. They can utilize their university days’ experiences to prepare such content that enables students to do well at their university.
Students can browse through our assignment samples right on our portal before trying out our university or history composition help services. Many students come to us to do my essay at cheap price. If they like our samples, then they can place their essay material order by filling our online form. Here, they can provide all their history or university paper details. After that, they can make the order’s online payment via PayPal. Once the payment is made, they can expect to receive the order material right in the inbox of their registered account on our website. We assure of grade-winning composition work within the students’ budget.

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?