summaryrefslogtreecommitdiff
path: root/tools/genuuid
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2011-10-11 15:32:53 -0500
committerJohn Wiegley <johnw@newartisans.com>2011-10-11 15:32:53 -0500
commit102a26d99ea61c85035ef3d9c0e98fed29a84930 (patch)
tree02cee1c585ef2721be438ba2b5b6c62d1a7f571c /tools/genuuid
parent550a795283126bb83ce86a2ce86dd63634f98817 (diff)
downloadfork-ledger-102a26d99ea61c85035ef3d9c0e98fed29a84930.tar.gz
fork-ledger-102a26d99ea61c85035ef3d9c0e98fed29a84930.tar.bz2
fork-ledger-102a26d99ea61c85035ef3d9c0e98fed29a84930.zip
Added tools/genuuid
Diffstat (limited to 'tools/genuuid')
-rwxr-xr-xtools/genuuid28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/genuuid b/tools/genuuid
new file mode 100755
index 00000000..53fb7a0a
--- /dev/null
+++ b/tools/genuuid
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import re
+import sys
+
+def scan_path(path):
+ bug = uuid = None
+ with open(path, 'r') as fd:
+ for line in fd:
+ match = re.match('\*', line)
+ if match:
+ bug = uuid = None
+
+ match = re.search('\[\[bug:([0-9]+)\]\[#[0-9]+\]\]', line)
+ if match:
+ bug = match.group(1)
+ elif bug:
+ match = re.search(':ID:\s+(.+?)\s*$', line)
+ if match:
+ uuid = match.group(1)
+ print "UPDATE bugs SET cf_uuid='%s' WHERE bug_id=%s;" % (uuid, bug)
+
+scan_path('/Users/johnw/src/ledger/plan/TODO')
+scan_path('/Users/johnw/src/ledger/plan/TODO-3.0')
+scan_path('/Users/johnw/src/ledger/plan/TODO-2.6.2')
+scan_path('/Users/johnw/src/ledger/plan/TODO-2.6.1')
+
+### genuuid ends here