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
=== modified file 'collect'
--- collect 2012-02-01 18:15:21 +0000
+++ collect 2012-03-09 16:53:19 +0000
@@ -209,11 +209,16 @@
209 model_bp, model_bp.milestone_name, collector.lp, people_cache=people_cache,209 model_bp, model_bp.milestone_name, collector.lp, people_cache=people_cache,
210 error_collector=error_collector)210 error_collector=error_collector)
211211
212 if bp.whiteboard:212 # Get work items from both the whiteboard and the new workitems_text
213 for l in bp.whiteboard.splitlines():213 # property. Once the migration is completed and nobody's using the
214214 # whiteboard for work items we can change this to pull work items only
215 if (not in_workitems_block215 # from bp.workitems_text.
216 and not in_meta_block and not in_complexity_block):216 workitems_text = bp.whiteboard
217 if getattr(bp, 'workitems_text', '') != '':
218 workitems_text += "\n" + bp.workitems_text
219 if workitems_text:
220 for l in workitems_text.splitlines():
221 if not in_workitems_block:
217 m = work_items_re.search(l)222 m = work_items_re.search(l)
218 if m:223 if m:
219 in_workitems_block = True224 in_workitems_block = True
@@ -221,10 +226,6 @@
221 milestone = milestone_extract(m.group(1), valid_milestones)226 milestone = milestone_extract(m.group(1), valid_milestones)
222 dbg(' ... setting milestone to ' + str(milestone))227 dbg(' ... setting milestone to ' + str(milestone))
223 parser.milestone_name = milestone or parser.blueprint.milestone_name228 parser.milestone_name = milestone or parser.blueprint.milestone_name
224 if meta_re.search(l):
225 in_meta_block = True
226 if complexity_re.search(l):
227 in_complexity_block = True
228 continue229 continue
229230
230 if in_workitems_block:231 if in_workitems_block:
@@ -237,6 +238,15 @@
237 if workitem is not None:238 if workitem is not None:
238 work_items.append(workitem)239 work_items.append(workitem)
239240
241 if bp.whiteboard:
242 for l in bp.whiteboard.splitlines():
243 if not in_meta_block and not in_complexity_block:
244 if meta_re.search(l):
245 in_meta_block = True
246 if complexity_re.search(l):
247 in_complexity_block = True
248 continue
249
240 if in_meta_block:250 if in_meta_block:
241 dbg("\tmeta line (raw): '%s'" % (l.strip()))251 dbg("\tmeta line (raw): '%s'" % (l.strip()))
242 if not l.strip():252 if not l.strip():

Subscribers

People subscribed via source and target branches