helpful
helpful copied to clipboard
Looking in other manuals
Here's the documentation for magit-branch-pull-request
:
Function Signature
(magit-branch-pull-request PR)
Function Documentation
Create and configure a new branch from a pull-request.
Please see the manual for more information.
Not very helpful! Of course I could hit C-h i, go to the Magit manual, and search for that function, but wouldn't it be great if the Helpful buffer offered a manual link like it does with basic Elisp functions? I have no clue how this would work, but it sure would be useful!
Are you using latest helpful
? It gives me a more complete output than your report for magit-branch-pull-request
:
magit-branch-pull-request is an interactive function defined in
magit-branch.el.
Function Signature
(magit-branch-pull-request PR)
Function Documentation
Create and configure a new branch from a pull-request.
Please see the manual for more information.
Key Bindings
This command is not in any keymaps.
References
References in magit-branch.el:
(defun magit-checkout-pull-request ...) 1 reference
Find all references
Debugging
Enable edebug Enable tracing
Disassemble Forget
Source Code
;; Defined in /home/manuel/.emacs.d/elpa/magit-20180406.1110/magit-branch.el
(defun magit-branch-pull-request (pr)
"Create and configure a new branch from a pull-request.
Please see the manual for more information."
(interactive (list (magit-read-pull-request "Branch pull request")))
(let-alist pr
(let* ((upstream (or (--first (magit--github-url-equal
(magit-get "remote" it "url")
.base.repo.ssh_url)
(magit-list-remotes))
(user-error
"Upstream repository %s not available as a remote"
.base.repo.ssh_url)))
(upstream-url (magit-get "remote" upstream "url"))
(upstream-pr-p (equal .head.repo.full_name
.base.repo.full_name))
(remote .head.repo.owner.login)
(branch .head.ref)
(pr-branch branch))
(when (and (not upstream-pr-p)
(or (not .maintainer_can_modify)
(magit-branch-p branch)))
(setq branch (format "pr-%s" .number)))
(when (magit-branch-p branch)
(user-error "Branch `%s' already exists" branch))
(if upstream-pr-p
(let ((tracking (concat upstream "/" pr-branch)))
(unless (magit-branch-p tracking)
(magit-call-git "fetch" upstream))
(let ((inhibit-magit-refresh t))
(magit-branch branch tracking)))
(if (magit-remote-p remote)
(let ((url (magit-get "remote" remote "url"))
(fetch (magit-get-all "remote" remote "fetch")))
(unless (magit--github-url-equal url .head.repo.ssh_url)
(user-error
"Remote `%s' already exists but does not point to %s"
remote url))
(unless (member (format "+refs/heads/*:refs/remotes/%s/*" remote)
fetch)
(magit-call-git "remote" "set-branches"
"--add" remote pr-branch)
(magit-call-git "fetch" remote)))
(magit-call-git
"remote" "add" "-f" "--no-tags"
"-t" pr-branch remote
(cond ((or (string-prefix-p "git@" upstream-url)
(string-prefix-p "ssh://git@" upstream-url))
.head.repo.ssh_url)
((string-prefix-p "https://" upstream-url)
.head.repo.clone_url)
((string-prefix-p "git://" upstream-url)
.head.repo.git_url)
(t (error "%s has an unexpected format" upstream-url)))))
(magit-call-git "branch" branch (concat remote "/" pr-branch))
(magit-set "true" "branch" branch "rebase")
(if (or .locked (not (equal branch pr-branch)))
(magit-set upstream "branch" branch "pushRemote")
(magit-set remote "branch" branch "pushRemote"))
(magit-set remote "branch" branch "pullRequestRemote"))
(magit-call-git "branch" branch
(concat "--set-upstream-to="
(if magit-branch-prefer-remote-upstream
(concat upstream "/" .base.ref)
.base.ref)))
(magit-set (number-to-string .number) "branch" branch "pullRequest")
(magit-set .title "branch" branch "description")
(magit-refresh)
branch)))
Symbol Properties
event-symbol-element-mask
(magit-branch-pull-request 0)
event-symbol-elements
(magit-branch-pull-request)
modifier-cache
((0 . magit-branch-pull-request))
Yeah, I get the same output. I didn't include it because this is a feature request, not a bug report :)
Oh I see, sorry. I thought you were getting less information. :)
I've poked at this a bit, but I've not found a nice way to find magit references in the manual. I can use C-s
to find things quite quickly (starting at the info manual root) or M-x info-apropos RET magit-branch-pull-request RET
(slow).
I really like the idea though, so any suggestions welcome :). I'll have another go at some point.