help="Log in with this Bugzilla username")
parser.add_argument('--password',
help="Log in with this Bugzilla password")
+ parser.add_argument('--comments', action='store_true',
+ help="Put JSON into comments")
args = parser.parse_args()
try:
with args.config as config_file:
write_budget_markdown(budget_graph, args.output_dir)
write_budget_csv(budget_graph, args.output_dir)
summarize_milestones(budget_graph)
- json_milestones(budget_graph)
+ json_milestones(budget_graph, args.comments)
def print_markdown_for_person(budget_graph: BudgetGraph, config: Config,
print ("```") # for using the output as markdown
-def json_milestones(budget_graph):
+def json_milestones(budget_graph, add_comments):
"""reports milestones as json format
"""
for milestone, payments in budget_graph.milestone_payments.items():
for child in canonical.immediate_children:
milestones = []
# include the task itself as a milestone
- for st in [child] + list(child.children()):
- amount = st.fixed_budget_including_subtasks.int()
+ for st in list(child.children()) + [child]:
+ amount = st.fixed_budget_excluding_subtasks.int()
if amount == 0: # skip anything at zero
continue
- task = {'description': "%d %s" % (st.bug.id, st.bug.summary),
- 'intro': [],
+ # if "task itself" then put the milestone as "wrapup"
+ if st.bug == child.bug:
+ description = 'wrapup'
+ intro = []
+ else:
+ # otherwise create a description and get comment #0
+ description = "%d %s" % (st.bug.id, st.bug.summary)
+ # add parent and MoU top-level
+ parent_id = st.parent.bug.id
+ if parent_id != child.bug.id:
+ description += "\n(Sub-sub-task of %d)" % parent_id
+ task = {'description': description,
'amount': amount,
- 'url': st.bug_url,
}
- # add parent and MoU top-level
- parent_id = st.parent.bug.id,
- if parent_id != milestone.canonical_bug_id:
- task['parent'] = parent_id
- mou_bug = st.closest_bug_in_mou
- if mou_bug is not None:
- task['mou_task'] = mou_bug.bug.id
+ #mou_bug = st.closest_bug_in_mou
+ #if mou_bug is not None:
+ # task['mou_task'] = mou_bug.bug.id
milestones.append(task)
- # create MoU task
+ # create MoU task: get comment #0
+ intro = []
+ comment = "%s\n " % child.bug_url
+ if add_comments:
+ comments = child.bug.getcomments()
+ comment += "\n%s" % comments[0]['text']
+ intro.append(comment)
+ print (description, intro)
+ sys.stdout.flush()
task = {'title': "%d %s" % (child.bug.id, child.bug.summary),
- 'intro': [],
+ 'intro': intro,
'amount': child.fixed_budget_including_subtasks.int(),
- 'url': child.bug_url,
+ 'url': "{{ %s }} " % child.bug_url,
'milestones': milestones
}
tasks.append(task)
d = {'participants': ppl,
'preamble': '',
'type': 'Group',
+ 'url': canonical.bug_url,
'plan': { 'intro': [''],
'tasks': tasks,
'rfp_secret': '',