-
Notifications
You must be signed in to change notification settings - Fork 7
/
get-redmine-issues
executable file
·52 lines (40 loc) · 1.39 KB
/
get-redmine-issues
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
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
TRACKERS = ['http://tracker.pardus.org.tr']
if len(sys.argv) == 1:
print ' Usage: %s PROJECT_KEY ' % sys.argv[0]
sys.exit()
if __name__ == '__main__':
import piksemel
import urlgrabber
tracker = 1
if len(TRACKERS) > 1:
print 'There are following trackers available:'
print
for id, tracker in enumerate(TRACKERS):
print ' [%s] %s' % (id+1, tracker)
print
tracker = None
while not type(tracker) == int:
tracker = int(raw_input(' Which tracker do you want to use ?'))
__issues = urlgrabber.urlopen('%s/projects/%s/issues.atom' % (TRACKERS[tracker-1], sys.argv[1])).read()
__piks_obj = piksemel.parseString(unicode(__issues))
__result = filter(lambda x:x, [tag.getTagData('title') for tag in __piks_obj.tags()])
def seperateIssues(raw):
issues = {}
for issue in raw:
key = issue.split()[0]
if not issues.has_key(key):
issues[key] = []
issues[key].append(issue.lstrip(key))
return issues
def printIssues(issues):
print
for key in issues.keys():
print ' - %ss ' % key, '-' * (76 - len(key))
print
for issue in issues[key]:
print ' -', issue
print
printIssues(seperateIssues(__result))