Open agzam opened 2 years ago
at least for (github) sections this works :)
(defun my/code-review-jump-to-gh ()
(interactive)
(unless (equal "*Code Review*" (buffer-name)) (error "Need to be in code-review buffer for this"))
(let* ((pr (code-review-db-get-pullreq))
(owner (oref pr owner))
(pr-number (oref pr number))
(repo (oref pr repo))
(path (alist-get 'path (oref (magit-current-section) value)))
(sha256 (--> (shell-command-to-string (format "echo -n \"%s\" | shasum -a 256 | cut -d ' ' -f1" path)) ;; kindly discovered via https://github.com/orgs/community/discussions/55764
s-lines
-butlast ; there is a new line at the end of the output
-last-item
s-trim))
(url (format "https://github.com/%s/%s/pull/%s/files#diff-%s" owner repo pr-number sha256)))
(browse-url url)))
Very often, I need to store a URL to a comment in the review; a file; or refer to a specific line (or lines) in the code. How difficult would it be to add a function that allows you to copy/store/jump-to URL to specific objects in a review?