Merge lp:~ursinha/uci-team/remove-spec-add-branch-nick into lp:uci-team

Proposed by Ursula Junque
Status: Merged
Approved by: Evan
Approved revision: 10
Merged at revision: 6
Proposed branch: lp:~ursinha/uci-team/remove-spec-add-branch-nick
Merge into: lp:uci-team
Diff against target: 177 lines (+20/-29)
1 file modified
xxxreport.py (+20/-29)
To merge this branch: bzr merge lp:~ursinha/uci-team/remove-spec-add-branch-nick
Reviewer Review Type Date Requested Status
Evan (community) Approve
Review via email: mp+238619@code.launchpad.net

Commit message

Removing reference to specs, we're not using blueprints; Adding branch nick to refer to scanned branch; Changing Launchpad to uci-engine.

Description of the change

Some suggested improvements to the XXX reports, feel free to ignore:
- Removing reference to specs, we're not using blueprints (and don't think we plan to in a near future :P)
- Adding branch nick to refer to scanned branch;
- Changing Launchpad to uci-engine.

To post a comment you must log in.
Revision history for this message
Evan (ev) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'xxxreport.py'
2--- xxxreport.py 2014-10-15 10:54:08 +0000
3+++ xxxreport.py 2014-10-16 19:47:16 +0000
4@@ -1,6 +1,6 @@
5 #!/usr/bin/python
6 #
7-# Copyright 2009 Canonical Ltd. This software is licensed under the
8+# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
9 # GNU Affero General Public License version 3 (see the file LICENSE).
10
11 """Create a XXX comment reports in many formats."""
12@@ -40,7 +40,7 @@
13 "Root directory does not exist: %s." % root_dir)
14 self.root_dir = root_dir
15 self.output_name = output_name
16- self.revno = self._getBranchRevno()
17+ self.revno, self.nick = self._getBranchInfo()
18 self.comments = self._findComments()
19
20 def _close(self, output_file):
21@@ -48,8 +48,8 @@
22 if self.output_name is not None:
23 output_file.close()
24
25- def _getBranchRevno(self):
26- """Return the bazaar revision number of the branch or None."""
27+ def _getBranchInfo(self):
28+ """Return the bazaar revision number of the branch and nick or None."""
29 # pylint: disable-msg=W0612
30 a_bzrdir = bzrdir.BzrDir.open_containing(self.root_dir)[0]
31 try:
32@@ -57,11 +57,12 @@
33 branch.lock_read()
34 try:
35 revno, head = branch.last_revision_info()
36+ nick = branch.nick
37 finally:
38 branch.unlock()
39 except NotBranchError:
40- revno = None
41- return revno
42+ revno, nick = None
43+ return revno, nick
44
45 def _findComments(self):
46 """Set the list of XXX comments in files below a directory."""
47@@ -145,26 +146,24 @@
48 comments.append(comment)
49
50 # The standard XXX comment form of:
51- # 'XXX: First Last Name 2007-07-01 bug=nnnn spec=cccc:'
52+ # 'XXX: First Last Name 2007-07-01 bug=nnnn'
53 # Colons, commas, and spaces may follow each token.
54 xxx_person_date_re = re.compile(r"""
55 .*XXX[:,]?[ ] # The XXX indicator.
56 (?P<person>[a-zA-Z][^:]*[\w])[,: ]* # The persons's nick.
57 (?P<date>\d\d\d\d[/-]?\d\d[/-]?\d\d)[,: ]* # The date in YYYY-MM-DD.
58 (?:[(]?bug[s]?[= ](?P<bug>[\w-]*)[),: ]*)? # The bug id.
59- (?:[(]?spec[= ](?P<spec>[\w-]*)[),: ]*)? # The spec name.
60 (?P<text>.*) # The comment text.
61 """, re.VERBOSE)
62
63 # An uncommon XXX comment form of:
64- # 'XXX: 2007-01-01 First Last Name bug=nnnn spec=cccc:'
65+ # 'XXX: 2007-01-01 First Last Name bug=nnnn'
66 # Colons, commas, and spaces may follow each token.
67 xxx_date_person_re = re.compile(r"""
68 .*XXX[:,]?[ ] # The XXX indicator.
69 (?P<date>\d\d\d\d[/-]?\d\d[/-]?\d\d)[,: ]* # The date in YYYY-MM-DD.
70 (?P<person>[a-zA-Z][\w]+)[,: ]* # The person's nick.
71 (?:[(]?bug[s]?[= ](?P<bug>[\w-]*)[),: ]*)? # The bug id.
72- (?:[(]?spec[= ](?P<spec>[\w-]*)[),: ]*)? # The spec name.
73 (?P<text>.*) # The comment text.
74 """, re.VERBOSE)
75
76@@ -173,10 +172,10 @@
77
78 :param comment_line: The first line of an XXX comment contains the
79 metadata.
80- :return: dict(person, date, bug, spec, and [text]). The text is the
81+ :return: dict(person, date, bug and [text]). The text is the
82 same as remainder of the comment_line after the metadata is extracted.
83 """
84- comment = dict(person=None, date=None, bug=None, spec=None, text=[])
85+ comment = dict(person=None, date=None, bug=None, text=[])
86 match = (self.xxx_person_date_re.match(comment_line)
87 or self.xxx_date_person_re.match(comment_line))
88 if match is not None:
89@@ -184,7 +183,6 @@
90 comment['person'] = match.group('person')
91 comment['date'] = match.group('date')
92 comment['bug'] = match.group('bug') or None
93- comment['spec'] = match.group('spec') or None
94 text = match.group('text').lstrip(':, ')
95 else:
96 # Unknown comment format.
97@@ -222,7 +220,7 @@
98 <!DOCTYPE html>
99 <html>
100 <head>
101- <title>XXX Comment report for Launchpad</title>
102+ <title>XXX Comment report for uci-engine</title>
103 <style type="text/css" media="screen, print">
104 @import url(https://launchpad.net/+icing/rev6895/+style-slimmer.css);
105 .context {
106@@ -233,12 +231,12 @@
107 </head>
108
109 <body style="margin: 1em;">
110- <h1>XXX Comment report for Launchpad</h1>
111+ <h1>XXX Comment report for uci-engine</h1>
112
113 <p>
114- A report of the XXX comments in the rocketfuel branch. All files
115+ A report of the XXX comments in the uci-engine %(nick)s branch. All files
116 except *.pyc files were examined.
117- <br />This report may also be available as a tab-delimted file:
118+ <br />This report may also be available as a tab-delimited file:
119 <a href="xxx-report.csv">xxx-report.csv</a>
120 </p>
121
122@@ -266,7 +264,6 @@
123 <strong class="person">%(person)s</strong>
124 <strong class="date">%(date)s</strong>
125 bug %(bugurl)s
126- spec %(specurl)s
127 </div>
128 <pre style="margin-top: 0px;">%(text)s</pre>
129 <pre class="context">%(context)s</pre>
130@@ -287,6 +284,7 @@
131 output_file.write(
132 self.report_top % {"commentcount": len(self.comments),
133 "reporttime": report_time,
134+ "nick" : self.nick,
135 "revno": self.revno})
136
137 for comment in self.comments:
138@@ -298,13 +296,6 @@
139 % (comment['bug'], comment['bug']))
140 else:
141 comment['bugurl'] = comment['bug']
142- if comment['spec'] is not None:
143- comment['specurl'] = (
144- '<a href="https://blueprints.launchpad.net'
145- '/launchpad-project/+specs?searchtext=%s">%s</a>'
146- % (comment['spec'], comment['spec']))
147- else:
148- comment['specurl'] = comment['spec']
149 output_file.write(self.report_comment % comment)
150
151 output_file.write(self.report_bottom)
152@@ -327,10 +318,10 @@
153 class CSVReport(Report):
154 """A CSV XXX report."""
155 report_header = (
156- 'File_Path, Line_No, Person, Date, Bug, Spec, Text\n')
157+ 'File_Path, Line_No, Person, Date, Bug, Text\n')
158 report_comment = (
159 '%(file_path)s, %(line_no)s, '
160- '%(person)s, %(date)s, %(bug)s, %(spec)s, %(text)s\n')
161+ '%(person)s, %(date)s, %(bug)s, %(text)s\n')
162
163 def markupText(self, text):
164 """Return the line as TSV markup.
165@@ -357,10 +348,10 @@
166 class TSVReport(CSVReport):
167 """A TSV XXX report."""
168 report_header = (
169- 'File_Path\tLine_No\tPerson\tDate\tBug\tSpec\tText\n')
170+ 'File_Path\tLine_No\tPerson\tDate\tBug\tText\n')
171 report_comment = (
172 '%(file_path)s\t%(line_no)s\t'
173- '%(person)s\t%(date)s\t%(bug)s\t%(spec)s\t%(text)s\n')
174+ '%(person)s\t%(date)s\t%(bug)s\t%(text)s\n')
175
176 def markupText(self, text):
177 """Return the line as TSV markup.

Subscribers

People subscribed via source and target branches

to all changes: