-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump-bugzilla.py
More file actions
executable file
·39 lines (29 loc) · 916 Bytes
/
dump-bugzilla.py
File metadata and controls
executable file
·39 lines (29 loc) · 916 Bytes
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
32
33
34
35
36
37
38
39
#!/usr/bin/python
import sys
from bugz import bugzilla
from xml.etree.ElementTree import tostring
from osc.core import xmlindent
bugid = sys.argv[1]
x = bugzilla.Bugz('url to bugzilla', httpuser='', httppassword='')
response = x.get(bugid)
root = response.getroot()
bugroot = root.getchildren()[0]
xmlindent(bugroot)
bugtext = tostring(bugroot)
cleanbug = []
wanted = ["bug","desc","estimated_time","text","comment","depend","block"]
not_wanted = ["actual_time", "remaining_time", "bug_when"]
for line in bugtext.split("\n"):
if line.strip().startswith("<"):
for want in wanted:
if want in line:
cleanbug.append(line)
break
else:
cleanbug.append(line)
for line in cleanbug:
if line.strip().startswith("<"):
for nwant in not_wanted:
if nwant in line:
cleanbug.remove(line)
print "\n".join(cleanbug)