~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/check-newsbugs.py

  • Committer: Vincent Ladeuil
  • Date: 2010-08-31 08:25:15 UTC
  • mfrom: (5247.7.1 catch-them-all)
  • mto: This revision was merged to the branch mainline in revision 5400.
  • Revision ID: v.ladeuil+lp@free.fr-20100831082515-an9mtdmhalo7xaq0
Merge catch-them-all into more-ignored-exceptions

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
import getopt, re, sys
6
6
try:
7
7
    from launchpadlib.launchpad import Launchpad
8
 
    from lazr.restfulclient import errors
9
8
except ImportError:
10
9
    print "Please install launchpadlib from lp:launchpadlib"
11
10
    sys.exit(1)
12
 
try:
13
 
    import hydrazine
14
 
except ImportError:
15
 
    print "Please install hydrazine from lp:launchpadlib"
16
 
    sys.exit(1)
17
 
 
18
11
 
19
12
options, args = getopt.gnu_getopt(sys.argv, "l", ["launchpad"])
20
13
options = dict(options)
68
61
        f.close()
69
62
 
70
63
 
71
 
def print_bug_url(bugno):
72
 
    print '<URL:http://pad.lv/%s>' % (bugno,)
 
64
lp = Launchpad.login_anonymously('bzr-check-newsbugs', 'edge', version='1.0')
73
65
 
74
 
launchpad = hydrazine.create_session()
75
66
bugnos = read_news_bugnos(args[1])
76
67
for bugno, section in bugnos:
77
 
    try:
78
 
        bug = launchpad.bugs[bugno]
79
 
    except errors.HTTPError, e:
80
 
        if e.response.status == 401:
81
 
            print_bug_url(bugno)
82
 
            # Private, we can't access the bug content
83
 
            print '%s is private and cannot be accessed' % (bugno,)
84
 
            continue
85
 
        raise
86
 
     
 
68
    bug = lp.bugs[bugno]
87
69
    found_bzr = False
88
 
    fix_released = False
89
70
    for task in bug.bug_tasks:
90
 
        parts = task.bug_target_name.split('/')
91
 
        if len(parts) == 1:
92
 
            project = parts[0]
93
 
            distribution = None
94
 
        else:
95
 
            project = parts[0]
96
 
            distribution = parts[1]
97
 
        if project == "bzr":
 
71
        if task.bug_target_name == "bzr":
98
72
            found_bzr = True
99
 
            if not fix_released and task.status == "Fix Released":
100
 
                # We could check that the NEWS section and task_status are in
101
 
                # sync, but that would be overkill. (case at hand: bug #416732)
102
 
                fix_released = True
103
 
 
 
73
            if task.status != "Fix Released":
 
74
                report_notmarked(bug, task, section)
104
75
    if not found_bzr:
105
 
        print_bug_url(bugno)
106
76
        print "Bug %d was mentioned in NEWS but is not marked as affecting bzr" % bugno
107
 
    elif not fix_released:
108
 
        print_bug_url(bugno)
109
 
        report_notmarked(bug, task, section)