blob: 0ad5bd9223ef5b8e3b46b46d1fe499eb242f5964 (
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
29
30
31
|
#!/usr/bin/env python3
import re
import sys
def scan_path(path):
bug = uuid = None
try:
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(f"UPDATE bugs SET cf_uuid='{uuid}' WHERE bug_id={bug};")
except FileNotFoundError:
print(f'{path}: No such file or directory')
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
|