* Reports the build number of a given darcs repository of mussa.
* In support for ticket:124.
--- /dev/null
+#!/usr/bin/python
+
+import re
+import subprocess
+import sys
+
+#_build_search = re.compile('^(Mon)|(Tue)|(Wed)|(Thu)|(Fri)|(Sat)|(Sun)', re.MULTILINE)
+_build_search = re.compile('</patch>', re.MULTILINE)
+
+def getBuildNumber():
+ """Counts the number of patches that have been made and
+ returns that as the build number."""
+
+ p = subprocess.Popen(['darcs', 'changes', '--xml-output'], stdout=subprocess.PIPE)
+ data = p.stdout.read()
+ build_num = len(_build_search.findall(data))
+ return build_num
+
+if __name__ == '__main__':
+ print "%s" % (getBuildNumber())