Feature/using GitHub pull request template#22
Conversation
jd
left a comment
There was a problem hiding this comment.
Squash all patches into one commit only.
| title = "Pull request for " + end | ||
| message = "\n".join(titles) | ||
|
|
||
| pr_template = find_pull_request_template() |
There was a problem hiding this comment.
This should be done L 147 directly, no need to do the lines above.
| pr_template = find_pull_request_template() | ||
| if pr_template: | ||
| content = get_pr_template_message(pr_template) | ||
| return title, content |
There was a problem hiding this comment.
This is wrong, this is called when editing a pull request and in this case you don't want to override the content of the existing PR with the template.
jd
left a comment
There was a problem hiding this comment.
Still need to squash those commits :)
|
|
||
|
|
||
| class TestMessageEditor(unittest.TestCase): | ||
| class TestMessageEditor(fixtures.TestWithFixtures): |
| return "Pull request for " + end | ||
|
|
||
|
|
||
| def generate_message(titles, end): |
There was a problem hiding this comment.
both these are only used once so not sure it's worth creating them TBH
| title = generate_title(titles, end) | ||
| pr_template = find_pull_request_template() | ||
| if pr_template: | ||
| LOG.warning( |
| body.write(title + "\n\n") | ||
| body.write(message + "\n") | ||
| status = os.system(editor + " " + bodyfilename) | ||
| status = os.system(get_editor() + " " + bodyfilename) |
There was a problem hiding this comment.
rather than doing a get_editor() function, do a edit_file function that you can use here and in get_pr_template_message.
|
I like the fact that you contribute to git-pull-request without using it it seems ;) |
70998e4 to
41ea1ac
Compare
|
@jd tester is doubting ;) |
41ea1ac to
2d2fe4a
Compare
|
applying your last review done! |
| if status != 0: | ||
| raise RuntimeError("Editor exited with status code %d" % status) | ||
| edit_file(bodyfilename) | ||
|
|
There was a problem hiding this comment.
You can also factorize the read/unlink part IMHO.
just rename to edit_file_get_content_and_remove or something like that if you wish ;)
2d2fe4a to
e899df8
Compare
Using pull request template file for PR message when is detected in project sources.
Users are invited to fill the template in defined system editor ($EDITOR)