Merge lp:~salgado/launchpad-work-items-tracker/linaro-use-lp-workitems-property into lp:~linaro-automation/launchpad-work-items-tracker/linaro

Proposed by Guilherme Salgado
Status: Merged
Approved by: Mattias Backman
Approved revision: 334
Merged at revision: 333
Proposed branch: lp:~salgado/launchpad-work-items-tracker/linaro-use-lp-workitems-property
Merge into: lp:~linaro-automation/launchpad-work-items-tracker/linaro
Diff against target: 52 lines (+19/-9)
1 file modified
collect (+19/-9)
To merge this branch: bzr merge lp:~salgado/launchpad-work-items-tracker/linaro-use-lp-workitems-property
Reviewer Review Type Date Requested Status
Mattias Backman (community) Approve
Linaro Infrastructure Pending
Review via email: mp+96152@code.launchpad.net

Description of the change

Change lp_import_blueprint_workitems to get work items from the workitems_text
API property instead of the whiteboard.

Soon we'll be migrating all work items in LP from the whiteboard to a new
field. This will allow us to implement things like
https://dev.launchpad.net/Projects/WorkItems in Launchpad.

Because of that, lp-wi-tracker will have to extract work items from the new
property (workitems_text), which uses the existing format for work items.

To post a comment you must log in.
Revision history for this message
Mattias Backman (mabac) wrote :

> Because of that, lp-wi-tracker will have to extract work items from the new
> property (workitems_text), which uses the existing format for work items.

It just struck me that we don't use exactly the same format. I thought it would be redundant to have the leading "Work items:" line in the Work Items text area, so I omitted that. Perhaps we should tweak workitems_text to include that line for work item blocks that are not milestoned.

If we don't do that we need to do

    if bp.workitems_text:
        in_workitems_block = True
        for l in bp.workitems_text.splitlines():
            if not in_workitems_block:

so we assume we're in a workitems_block from the beginning of the workitems_text field. If there are no non-milestoned work items, the field would of course start with a "Work items for 2012.x:" line but then the entire bp should be retargetted.

review: Needs Fixing
334. By Guilherme Salgado

Pull work items from both the whiteboard and the new .workitems_text property

Revision history for this message
Mattias Backman (mabac) wrote :

Looks good to me.

review: Approve
Revision history for this message
Mattias Backman (mabac) wrote :

I see that it has been running on staging for a while too, so there should be no problems.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'collect'
2--- collect 2012-02-01 18:15:21 +0000
3+++ collect 2012-03-09 16:53:19 +0000
4@@ -209,11 +209,16 @@
5 model_bp, model_bp.milestone_name, collector.lp, people_cache=people_cache,
6 error_collector=error_collector)
7
8- if bp.whiteboard:
9- for l in bp.whiteboard.splitlines():
10-
11- if (not in_workitems_block
12- and not in_meta_block and not in_complexity_block):
13+ # Get work items from both the whiteboard and the new workitems_text
14+ # property. Once the migration is completed and nobody's using the
15+ # whiteboard for work items we can change this to pull work items only
16+ # from bp.workitems_text.
17+ workitems_text = bp.whiteboard
18+ if getattr(bp, 'workitems_text', '') != '':
19+ workitems_text += "\n" + bp.workitems_text
20+ if workitems_text:
21+ for l in workitems_text.splitlines():
22+ if not in_workitems_block:
23 m = work_items_re.search(l)
24 if m:
25 in_workitems_block = True
26@@ -221,10 +226,6 @@
27 milestone = milestone_extract(m.group(1), valid_milestones)
28 dbg(' ... setting milestone to ' + str(milestone))
29 parser.milestone_name = milestone or parser.blueprint.milestone_name
30- if meta_re.search(l):
31- in_meta_block = True
32- if complexity_re.search(l):
33- in_complexity_block = True
34 continue
35
36 if in_workitems_block:
37@@ -237,6 +238,15 @@
38 if workitem is not None:
39 work_items.append(workitem)
40
41+ if bp.whiteboard:
42+ for l in bp.whiteboard.splitlines():
43+ if not in_meta_block and not in_complexity_block:
44+ if meta_re.search(l):
45+ in_meta_block = True
46+ if complexity_re.search(l):
47+ in_complexity_block = True
48+ continue
49+
50 if in_meta_block:
51 dbg("\tmeta line (raw): '%s'" % (l.strip()))
52 if not l.strip():

Subscribers

People subscribed via source and target branches