Created
August 19, 2019 09:59
-
-
Save tirkarthi/e25aabc406433fce7f45bcf6b719705e to your computer and use it in GitHub Desktop.
Open the bug and PR for commit under cursor in magit mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun python-bugs-url () | |
(interactive) | |
(let ((commit-message (magit-rev-format "%B" | |
(magit-rev-parse | |
(magit-branch-or-commit-at-point)))) | |
(bugs-base-url "https://bugs.python.org/issue") | |
(pr-base-url "https://github.com/python/cpython/pull/") | |
(bugs-pr-regex "bpo-\\([0-9]+\\).*\\(GH-\\|#\\)\\([0-9]+\\)")) | |
(when (string-match bugs-pr-regex commit-message) | |
(let ((bug-url (concat bugs-base-url (match-string 1 commit-message))) | |
(pr-url (concat pr-base-url (match-string 3 commit-message)))) | |
(browse-url bug-url) | |
(browse-url pr-url))))) | |
(magit-define-popup-action 'magit-log-popup | |
?z | |
"Open bug in browser" | |
'python-bugs-url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(my eyes!)