Muffinresearch Labs by Stuart Colville

Django: Switching between development branches | Comments (2)

Posted in Code, Linux/Unix on 9th March 2008, 7:47 pm by Stuart

Cyril and I have been using new forms admin for some stuff we are working on for fun whilst we are here at SXSWi. One of the issues is that if you’re developing several different Django sites you won’t necessary want to migrate away from trunk to migrate everything to one of the other branches that you’re trying out. Obviously at some point in the future work like the new forms admin branch and the queryset refactor branch will be merged back to trunk and you’ll want to switch back.

To make life a little easier I knocked up a simple shell script to switch between branches by changing the symlink to site-packages. This assumes you are already using the method which symlinks the svn source into site-packages.

As long as the branches are in the same directory this script will work as it simply creates a selection based on the branches contained withing the directory specifed in the constant “DJANGOBRANCHES”. Simply change the constant to meet your needs:

#!/usr/bin/env bash

DJANGOBRANCHES=/Users/muffin/django/
SITEPACKAGES=/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/

cd $DJANGOBRANCHES
echo 'Choose Django branch:'

select dir in *;
do
    if [ -n "$dir" ] && [ -d ${DJANGOBRANCHES}${dir}/ ]
    then
      rm -f ${SITEPACKAGES}django
      ln -s ${DJANGOBRANCHES}${dir}/django ${SITEPACKAGES}django
      break
    else
      echo “Error: You choice ‘$REPLY’ does not correspond to a branch”
    fi
done

exit 0

Using the script is simple:

muffin@shiva muffin/django $ switch_django
Choose Django branch
1) django_src
2) newforms-admin
#? 2

Check the site-packages directory and you should see the correct branch is now sym-linked.

Post Tools

Comments: Add yours

1. On March 18th, 2008 at 8:40 pm Justin Bronn said:

I also created a script, chdjango, (in Python) for the same purpose. However, it lacks the interactive menu — I may have to borrow that idea.

2. On March 18th, 2008 at 10:34 pm Stuart Colville said:

@justin: Great minds think alike!







XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Scrolling issue in Leopard cured with PRAM reset|(0)

Having got a shiny new MacBook Pro to work on at my new workplace I’ve had a couple of strange problems with Leopard. The main issue was that when scrolling the graphics was suffering what appeared to be a strange redraw problem when scrolling. After googling I found this post:“Distorted graphics in Leopard when scrolling”.

Fortunately for me: resetting the PRAM has worked and the flickering issue has gone for now.

Using git with Django’s SVN repository|(0)

Brian Rosner has produced a really nice screencast demonstrating ways to use git version control with Django’s SVN repository. Especially of interest is how merging changes you’ve made in your git branch of Django with updates from the Django SVN repository is really straightforward.

Photos on Flickr

© Copyright 2004-08 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosted by WebMax Nefarious Muffins. This page was baked in 0.712s.