version='0.1.2'
release=False

if not release:
    version += '.dev'

@@ -40,16 +40,325 @@
 elease:%0A
+    try:%0A        import subprocess%0A        proc = subprocess.Popen(%5B'bzr', 'revno'%5D, stdout=subprocess.PIPE)%0A        revno, errcode = proc.communicate()%0A        revno = int(revno)%0A        version += 'r%25d' %25 revno%0A    except OSError:%0A        # bzr was probably not found%0A        # just tack on a dev label%0A    
     vers

Add bzr revno to version on non-release.