-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sort issues hierarchically #6
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,6 +179,37 @@ def write_last_jira_comment(f, jira, issue): | |
except UnicodeEncodeError: | ||
vprint("Can't encode character") | ||
|
||
def write_one_issue(jira_issues, f, issue): | ||
global g_args | ||
last_comment = g_args.l | ||
|
||
if issue not in jira_issues: | ||
# Add parent as a comment | ||
f.write("#[%s] is parent of next issue\n" % issue) | ||
f.write("#parent of next issues\n" % issue) | ||
return | ||
|
||
if "done" in jira_issues[issue]: | ||
return | ||
|
||
if "parent" in jira_issues[issue]: | ||
write_one_issue(jira_issues, f, jira_issues[issue]["parent"]) | ||
|
||
if "done" in jira_issues[issue]: | ||
return | ||
|
||
# Write issue comments | ||
f.write("%s" % jira_issues[issue]["comments"]) | ||
f.write(get_extra_comments()) | ||
if last_comment: | ||
write_last_jira_comment(f, jira, issue) | ||
f.write("\n") | ||
|
||
jira_issues[issue]["done"] = "done" | ||
|
||
for child_issue in jira_issues: | ||
if "parent" in jira_issues[child_issue] and issue == jira_issues[child_issue]["parent"]: | ||
write_one_issue(jira_issues, f, child_issue) | ||
|
||
def get_jira_issues(jira, username): | ||
""" | ||
|
@@ -192,7 +223,6 @@ def get_jira_issues(jira, username): | |
all_status = g_args.all | ||
filename = g_args.file | ||
user = g_args.user | ||
last_comment = g_args.l | ||
|
||
issue_types = ["Epic"] | ||
if not epics_only: | ||
|
@@ -229,16 +259,28 @@ def get_jira_issues(jira, username): | |
|
||
f.write(msg) | ||
vprint("Found issue:") | ||
|
||
unsorted_issues={} | ||
for issue in my_issues: | ||
issue_id = "%s" % issue | ||
this_issue = {} | ||
|
||
this_issue["comments"] = "" | ||
vprint("%s : %s" % (issue, issue.fields.summary)) | ||
f.write("[%s]\n" % issue) | ||
f.write("# Header: %s\n" % issue.fields.summary) | ||
f.write("# Type: %s\n" % issue.fields.issuetype) | ||
f.write("# Status: %s\n" % issue.fields.status) | ||
f.write(get_extra_comments()) | ||
if last_comment: | ||
write_last_jira_comment(f, jira, issue) | ||
f.write("\n") | ||
this_issue["comments"] += "[%s]\n" % issue | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we keep all the writes here as done previously and then follow the same pattern as I did with show_parent: True And then here (just after line 237, # Status ...) add: try:
if g_yml_config['show_parent']:
f.write(write_parent(jira, issue))
except:
vprint("Parent not found in config") That means that the parent link also would need to go below the issue [SWG-3]
# Header: Generic TrustZone device driver for Linux kernel (upstream)
# Type: Epic
# Status: In Progress
# Parent: SWG-1
# No updates since last week. I think that would make it a bit cleaner and will give people the option to enable/disable parent links at will. Seems like people have lots of different opinions on what should be there by default and how that should look like. In that case it it probably best to make it configurable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My goal was to keep a kind of hierarchy But when a parent (parent2) is not in the list of issues to update we have Which can be a bit confusing so my goal was to add a comment when we change the parent Furthermore, this can be easily used to add a summary of childs activities into the parent by uncommenting the issue id There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, that's a bit different to how I first understood that it was supposed to be used. I was thinking it was just going to add a parent link to each issue. Let me think a bit more about this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, I've looked into this, currently you are checking for parents and then parse issues one by one and then mark them as done etc. How about instead adding all issues to a dictionary where the key is simply the parent. By doing so you can easily sort on the key (parent) if you want to and as a inner loop you print each issue belonging to that key/parent. That would give what you are asking for, but I think it's a bit easier to implement and read. If you want I can make a patch for it. Btw,
How do you figure out that it should be "parent2" if there is no parent? Or are you just grabbing a name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, some more thinking about this, it can be pretty complicated. What you want to achieve I guess is:
or
or
I.e, you want to show the tree. However, there are no limitations to how many parents you can have. One Epic can implement several Initiatives, likewise a Story can implement many Epics (this is not the normal case, but it can happen). So let's say an Epic implements two Initiatives, how should that be represented in text format?
Take it one more level, let's say Story1 implements Epic1 and Epic2, then things are becoming pretty complicated when it comes to how to represent it :) Just putting Stories in a group linking to a single Epic is easy, so is grouping Epics pointing to a single Initiative. But that will not cover the corner cases. |
||
this_issue["comments"] += "# Header: %s\n" % issue.fields.summary | ||
this_issue["comments"] += "# Type: %s\n" % issue.fields.issuetype | ||
this_issue["comments"] += "# Status: %s\n" % issue.fields.status | ||
|
||
for link in issue.fields.issuelinks: | ||
if "outwardIssue" in link.raw: | ||
parent = link.outwardIssue.key | ||
this_issue["parent"] = link.outwardIssue.key | ||
|
||
unsorted_issues[issue_id] = this_issue | ||
|
||
for issue in unsorted_issues: | ||
write_one_issue(unsorted_issues, f, issue) | ||
|
||
f.close() | ||
return filename | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is wrong and gives Python errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, a last minute changes with a wrong copy/paste to try to make comment more readable.
Will fix it