Changed so pr can now take in URL as well as pr number.#30
Changed so pr can now take in URL as well as pr number.#30ttran428 wants to merge 90 commits intomachine-shop:masterfrom
Conversation
| def hub(command, args, user, comment, number, branch, sort, opened, label): | ||
| if command == "pr": | ||
| pr_num = int(args[0]) | ||
| if args[0].isdigit(): |
There was a problem hiding this comment.
It checks if the argument supplied is an integer (so either the pr number(i.e. 4) or the url(e.g. #35)) so that it knows whether to take it as an integer or to find the pr number inside the url.
There was a problem hiding this comment.
It changed the url I inputted into my comment. But like if the user inputted instead of '30', they inputted 'https://github.com/machine-shop/oss_devkit/pull/ 30'
There was a problem hiding this comment.
OK, I suggest adding comments to both branches of the "if", saying what you're expecting in each branch. This will help future developers see what you're doing.
git-hub
Outdated
There was a problem hiding this comment.
We can be slightly cleverer here, so that you can also paste in URLs like this:
https://github.com/machine-shop/oss_devkit/pull/30/files
We can do that by matching the URL to a regex, something that expects the form: https://github.com/(org_name)/(repo)/pull/(pr_nr)(/*)
There was a problem hiding this comment.
I changed it to using regex.
|
Changed to regex. |
Can now do "git hub pr 2" as well as "git hub pr {url for pr 2}"