summaryrefslogtreecommitdiff
path: root/tools/genuuid
blob: 53fb7a0a62fe58e48d3d26eceff8eb5843f3fa07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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