How to do a Code Tour

From Dreamwidth Notes
Revision as of 03:05, 11 November 2010 by Sophira (Talk | contribs)

Jump to: navigation, search

What is a code tour?

A code tour lists information about all of the bugs in Bugzilla that have been closed in the past week. You can view previous code tours in [info]dw_dev here.

How to make a code tour

First, find the ending date of the latest code tour post by viewing the previous code tours. Then, plug that date into the Code Tour Template Generator, and click Generate. The script will automatically find all the RESOLVED FIXED bugs that have been modified since then, and present a text box with a pre-filled template, which you should copy and paste into a text editor on your computer.

There may be a few bugs that overlap with the previous code tour; those should be listed at the top, and can be deleted. (If any bugs from the previous code tour are in the list, but don't appear at the top, that means they've been updated since the last code tour and you should check them in case there have been any new patches.)

You should double-check the 'Category' and 'Patch by' fields to make sure they accurately reflect the bug (for example, sometimes the "patch by" field only includes who made the patch, but other people may have worked on it, especially in the arena of themes - and sometimes the assignee on the bug isn't the one who actually does the patch!), and then write a description for the bug. By default, the text "FILL IN" is pre-filled to make it easy to search for at the end and see if you missed anything, but if you prefer it blank, there's a ticky box on the first page of the generator that will do that for you.

Then, make a post to [info]dw_dev tagged "code tour". The time to do these is generally Wednesday, so they can be included in the [info]dw_news update.

How to manually make a code tour

(You generally don't need to do this; this is just included for reference in case the generator fails. You should normally use the section above.)

First, get a link to a Bugzilla search from [info]denise or by putting the start and end dates of the week into this search form. Then, put the information each bug into this example format:

<a href="http://bugs.dwscoalition.org/show_bug.cgi?id=NNNN">Bug NNNN</a>: Bug Title
Category: What section of the site is this bug about?
Patch by: <user name="username"> or submitter name
Description: What problem does this bug solve, or what new feature does it add?

Then, make a post to [info]dw_dev tagged "code tour". The time to do these is generally Monday, so they can be included in the [info]dw_news update.

Makes sure to double check the bug--sometimes the "patch by" field only includes who made the patch, but other people may have worked on it, especially in the arena of themes.

How to make a Bugzilla search for a code tour

The base link is this: http://bugs.dwscoalition.org/buglist.cgi?&query_format=advanced&chfield=bug_status&bug_status=RESOLVED&resolution=FIXED

To that link, you want to add this to the end: &chfieldfrom=2010-03-02&chfieldto=Now where chfieldfrom has the day after the last code code tour on it (replace the 2010-03-02 with the appropriate date). You can replace chfieldto with a date, too, if you like, but "Now" should work.

Template Making Script

If you are comfortable with using Python on the command line, here is a script that can help you make a template with all the bugs in a CSV download of the week's bugs. (You can find the CSV download link on the bottom of the search page. You'll want to make sure to have these columns listed: Full Summary, Component, Assignee Realname, and Resolution.)

#!/usr/bin/env python
 
# usage: python code_tour_template.py bugs-2009-09-15.csv
 
import csv, re, sys
 
def parse_assignment(assign):
    """Attempt to parse the assignment for the submitter's username.
    Use the full assignment field otherwise."""
    # [:username]
    match = re.search('\[\:([a-z0-9_]+)\]', assign);
 
    try:
        return '<user name="%s">' % match.group(1)
    except (IndexError, AttributeError):
        return assign
 
# Get the CSV file for the bugs
bugs_file = sys.argv[1]
 
bugReader = csv.DictReader(open(bugs_file))
 
# This is a template for a bug record
template_record = """
<b><a href="http://bugs.dwscoalition.org/show_bug.cgi?id=%(bug_id)s">Bug %(bug_id)s</a>:</b> %(title)s
<b>Category:</b> %(category)s
<b>Patch by:</b> %(patch_by)s
<b>Description:</b> FILL IN
"""
 
# For each row in the bug CSV file, put the appropriate variables into
# the template and print
for row in bugReader:
    replacements = { "patch_by": parse_assignment(row["assigned_to_realname"]),
        "bug_id": row["bug_id"],
        "category": row["component"],
        "title": row["short_desc"] }
 
    print template_record % replacements

How to do a Bugs (old and new) Tour

<a href="http://bugs.dwscoalition.org/show_bug.cgi?id=XX">Bug XX</a>: SUMMARY Category: Reported on DATE by <user name="NAME"> Severity and Priority: Status: assigned to/unassigned Description:</b>

Then, make a post to [info]dw_dev tagged "code tour". The time to do these is generally Monday, so they can be included in the [info]dw_news update.