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
=== modified file 'xxxreport.py'
--- xxxreport.py 2014-10-15 10:54:08 +0000
+++ xxxreport.py 2014-10-16 19:47:16 +0000
@@ -1,6 +1,6 @@
1#!/usr/bin/python1#!/usr/bin/python
2#2#
3# Copyright 2009 Canonical Ltd. This software is licensed under the3# Copyright 2009-2014 Canonical Ltd. This software is licensed under the
4# GNU Affero General Public License version 3 (see the file LICENSE).4# GNU Affero General Public License version 3 (see the file LICENSE).
55
6"""Create a XXX comment reports in many formats."""6"""Create a XXX comment reports in many formats."""
@@ -40,7 +40,7 @@
40 "Root directory does not exist: %s." % root_dir)40 "Root directory does not exist: %s." % root_dir)
41 self.root_dir = root_dir41 self.root_dir = root_dir
42 self.output_name = output_name42 self.output_name = output_name
43 self.revno = self._getBranchRevno()43 self.revno, self.nick = self._getBranchInfo()
44 self.comments = self._findComments()44 self.comments = self._findComments()
4545
46 def _close(self, output_file):46 def _close(self, output_file):
@@ -48,8 +48,8 @@
48 if self.output_name is not None:48 if self.output_name is not None:
49 output_file.close()49 output_file.close()
5050
51 def _getBranchRevno(self):51 def _getBranchInfo(self):
52 """Return the bazaar revision number of the branch or None."""52 """Return the bazaar revision number of the branch and nick or None."""
53 # pylint: disable-msg=W061253 # pylint: disable-msg=W0612
54 a_bzrdir = bzrdir.BzrDir.open_containing(self.root_dir)[0]54 a_bzrdir = bzrdir.BzrDir.open_containing(self.root_dir)[0]
55 try:55 try:
@@ -57,11 +57,12 @@
57 branch.lock_read()57 branch.lock_read()
58 try:58 try:
59 revno, head = branch.last_revision_info()59 revno, head = branch.last_revision_info()
60 nick = branch.nick
60 finally:61 finally:
61 branch.unlock()62 branch.unlock()
62 except NotBranchError:63 except NotBranchError:
63 revno = None64 revno, nick = None
64 return revno65 return revno, nick
6566
66 def _findComments(self):67 def _findComments(self):
67 """Set the list of XXX comments in files below a directory."""68 """Set the list of XXX comments in files below a directory."""
@@ -145,26 +146,24 @@
145 comments.append(comment)146 comments.append(comment)
146147
147 # The standard XXX comment form of:148 # The standard XXX comment form of:
148 # 'XXX: First Last Name 2007-07-01 bug=nnnn spec=cccc:'149 # 'XXX: First Last Name 2007-07-01 bug=nnnn'
149 # Colons, commas, and spaces may follow each token.150 # Colons, commas, and spaces may follow each token.
150 xxx_person_date_re = re.compile(r"""151 xxx_person_date_re = re.compile(r"""
151 .*XXX[:,]?[ ] # The XXX indicator.152 .*XXX[:,]?[ ] # The XXX indicator.
152 (?P<person>[a-zA-Z][^:]*[\w])[,: ]* # The persons's nick.153 (?P<person>[a-zA-Z][^:]*[\w])[,: ]* # The persons's nick.
153 (?P<date>\d\d\d\d[/-]?\d\d[/-]?\d\d)[,: ]* # The date in YYYY-MM-DD.154 (?P<date>\d\d\d\d[/-]?\d\d[/-]?\d\d)[,: ]* # The date in YYYY-MM-DD.
154 (?:[(]?bug[s]?[= ](?P<bug>[\w-]*)[),: ]*)? # The bug id.155 (?:[(]?bug[s]?[= ](?P<bug>[\w-]*)[),: ]*)? # The bug id.
155 (?:[(]?spec[= ](?P<spec>[\w-]*)[),: ]*)? # The spec name.
156 (?P<text>.*) # The comment text.156 (?P<text>.*) # The comment text.
157 """, re.VERBOSE)157 """, re.VERBOSE)
158158
159 # An uncommon XXX comment form of:159 # An uncommon XXX comment form of:
160 # 'XXX: 2007-01-01 First Last Name bug=nnnn spec=cccc:'160 # 'XXX: 2007-01-01 First Last Name bug=nnnn'
161 # Colons, commas, and spaces may follow each token.161 # Colons, commas, and spaces may follow each token.
162 xxx_date_person_re = re.compile(r"""162 xxx_date_person_re = re.compile(r"""
163 .*XXX[:,]?[ ] # The XXX indicator.163 .*XXX[:,]?[ ] # The XXX indicator.
164 (?P<date>\d\d\d\d[/-]?\d\d[/-]?\d\d)[,: ]* # The date in YYYY-MM-DD.164 (?P<date>\d\d\d\d[/-]?\d\d[/-]?\d\d)[,: ]* # The date in YYYY-MM-DD.
165 (?P<person>[a-zA-Z][\w]+)[,: ]* # The person's nick.165 (?P<person>[a-zA-Z][\w]+)[,: ]* # The person's nick.
166 (?:[(]?bug[s]?[= ](?P<bug>[\w-]*)[),: ]*)? # The bug id.166 (?:[(]?bug[s]?[= ](?P<bug>[\w-]*)[),: ]*)? # The bug id.
167 (?:[(]?spec[= ](?P<spec>[\w-]*)[),: ]*)? # The spec name.
168 (?P<text>.*) # The comment text.167 (?P<text>.*) # The comment text.
169 """, re.VERBOSE)168 """, re.VERBOSE)
170169
@@ -173,10 +172,10 @@
173172
174 :param comment_line: The first line of an XXX comment contains the173 :param comment_line: The first line of an XXX comment contains the
175 metadata.174 metadata.
176 :return: dict(person, date, bug, spec, and [text]). The text is the175 :return: dict(person, date, bug and [text]). The text is the
177 same as remainder of the comment_line after the metadata is extracted.176 same as remainder of the comment_line after the metadata is extracted.
178 """177 """
179 comment = dict(person=None, date=None, bug=None, spec=None, text=[])178 comment = dict(person=None, date=None, bug=None, text=[])
180 match = (self.xxx_person_date_re.match(comment_line)179 match = (self.xxx_person_date_re.match(comment_line)
181 or self.xxx_date_person_re.match(comment_line))180 or self.xxx_date_person_re.match(comment_line))
182 if match is not None:181 if match is not None:
@@ -184,7 +183,6 @@
184 comment['person'] = match.group('person')183 comment['person'] = match.group('person')
185 comment['date'] = match.group('date')184 comment['date'] = match.group('date')
186 comment['bug'] = match.group('bug') or None185 comment['bug'] = match.group('bug') or None
187 comment['spec'] = match.group('spec') or None
188 text = match.group('text').lstrip(':, ')186 text = match.group('text').lstrip(':, ')
189 else:187 else:
190 # Unknown comment format.188 # Unknown comment format.
@@ -222,7 +220,7 @@
222<!DOCTYPE html>220<!DOCTYPE html>
223<html>221<html>
224 <head>222 <head>
225 <title>XXX Comment report for Launchpad</title>223 <title>XXX Comment report for uci-engine</title>
226 <style type="text/css" media="screen, print">224 <style type="text/css" media="screen, print">
227 @import url(https://launchpad.net/+icing/rev6895/+style-slimmer.css);225 @import url(https://launchpad.net/+icing/rev6895/+style-slimmer.css);
228 .context {226 .context {
@@ -233,12 +231,12 @@
233 </head>231 </head>
234232
235 <body style="margin: 1em;">233 <body style="margin: 1em;">
236 <h1>XXX Comment report for Launchpad</h1>234 <h1>XXX Comment report for uci-engine</h1>
237235
238 <p>236 <p>
239 A report of the XXX comments in the rocketfuel branch. All files237 A report of the XXX comments in the uci-engine %(nick)s branch. All files
240 except *.pyc files were examined.238 except *.pyc files were examined.
241 <br />This report may also be available as a tab-delimted file:239 <br />This report may also be available as a tab-delimited file:
242 <a href="xxx-report.csv">xxx-report.csv</a>240 <a href="xxx-report.csv">xxx-report.csv</a>
243 </p>241 </p>
244242
@@ -266,7 +264,6 @@
266 <strong class="person">%(person)s</strong>264 <strong class="person">%(person)s</strong>
267 <strong class="date">%(date)s</strong>265 <strong class="date">%(date)s</strong>
268 bug %(bugurl)s266 bug %(bugurl)s
269 spec %(specurl)s
270 </div>267 </div>
271 <pre style="margin-top: 0px;">%(text)s</pre>268 <pre style="margin-top: 0px;">%(text)s</pre>
272 <pre class="context">%(context)s</pre>269 <pre class="context">%(context)s</pre>
@@ -287,6 +284,7 @@
287 output_file.write(284 output_file.write(
288 self.report_top % {"commentcount": len(self.comments),285 self.report_top % {"commentcount": len(self.comments),
289 "reporttime": report_time,286 "reporttime": report_time,
287 "nick" : self.nick,
290 "revno": self.revno})288 "revno": self.revno})
291289
292 for comment in self.comments:290 for comment in self.comments:
@@ -298,13 +296,6 @@
298 % (comment['bug'], comment['bug']))296 % (comment['bug'], comment['bug']))
299 else:297 else:
300 comment['bugurl'] = comment['bug']298 comment['bugurl'] = comment['bug']
301 if comment['spec'] is not None:
302 comment['specurl'] = (
303 '<a href="https://blueprints.launchpad.net'
304 '/launchpad-project/+specs?searchtext=%s">%s</a>'
305 % (comment['spec'], comment['spec']))
306 else:
307 comment['specurl'] = comment['spec']
308 output_file.write(self.report_comment % comment)299 output_file.write(self.report_comment % comment)
309300
310 output_file.write(self.report_bottom)301 output_file.write(self.report_bottom)
@@ -327,10 +318,10 @@
327class CSVReport(Report):318class CSVReport(Report):
328 """A CSV XXX report."""319 """A CSV XXX report."""
329 report_header = (320 report_header = (
330 'File_Path, Line_No, Person, Date, Bug, Spec, Text\n')321 'File_Path, Line_No, Person, Date, Bug, Text\n')
331 report_comment = (322 report_comment = (
332 '%(file_path)s, %(line_no)s, '323 '%(file_path)s, %(line_no)s, '
333 '%(person)s, %(date)s, %(bug)s, %(spec)s, %(text)s\n')324 '%(person)s, %(date)s, %(bug)s, %(text)s\n')
334325
335 def markupText(self, text):326 def markupText(self, text):
336 """Return the line as TSV markup.327 """Return the line as TSV markup.
@@ -357,10 +348,10 @@
357class TSVReport(CSVReport):348class TSVReport(CSVReport):
358 """A TSV XXX report."""349 """A TSV XXX report."""
359 report_header = (350 report_header = (
360 'File_Path\tLine_No\tPerson\tDate\tBug\tSpec\tText\n')351 'File_Path\tLine_No\tPerson\tDate\tBug\tText\n')
361 report_comment = (352 report_comment = (
362 '%(file_path)s\t%(line_no)s\t'353 '%(file_path)s\t%(line_no)s\t'
363 '%(person)s\t%(date)s\t%(bug)s\t%(spec)s\t%(text)s\n')354 '%(person)s\t%(date)s\t%(bug)s\t%(text)s\n')
364355
365 def markupText(self, text):356 def markupText(self, text):
366 """Return the line as TSV markup.357 """Return the line as TSV markup.

Subscribers

People subscribed via source and target branches

to all changes: