Commit 50e05e4a authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-revision-insert-related-refs: Allow inserting remote branches

Closes #3487.
parent b768542a
......@@ -8,7 +8,7 @@
#+TEXINFO_DIR_CATEGORY: Emacs
#+TEXINFO_DIR_TITLE: Magit: (magit).
#+TEXINFO_DIR_DESC: Using Git from Emacs with Magit.
#+SUBTITLE: for version 2.13.0 (2.13.0-244-g47006165+1)
#+SUBTITLE: for version 2.13.0 (2.13.0-292-gb768542a2+1)
#+BIND: ox-texinfo+-before-export-hook ox-texinfo+-update-version-strings
#+TEXINFO_DEFFN: t
......@@ -23,7 +23,7 @@ directly from within Emacs. While many fine Git clients exist, only
Magit and Git itself deserve to be called porcelains.
#+TEXINFO: @noindent
This manual is for Magit version 2.13.0 (2.13.0-244-g47006165+1).
This manual is for Magit version 2.13.0 (2.13.0-292-gb768542a2+1).
#+BEGIN_QUOTE
Copyright (C) 2015-2018 Jonas Bernoulli <jonas@bernoul.li>
......@@ -2989,7 +2989,12 @@ These commands are available in diff buffers.
- User Option: magit-revision-insert-related-refs
Whether to show related refs in revision buffers.
Whether to show related branches in revision buffers.
- ~nil~ Don't show any related branches.
- ~t~ Show related local branches.
- ~all~ Show related local and remote branches.
- ~mixed~ Show all containing branches and local merged branches.
- User Option: magit-revision-show-gravatar
......
......@@ -30,7 +30,7 @@ General Public License for more details.
@finalout
@titlepage
@title Magit User Manual
@subtitle for version 2.13.0 (2.13.0-244-g47006165+1)
@subtitle for version 2.13.0 (2.13.0-292-gb768542a2+1)
@author Jonas Bernoulli
@page
@vskip 0pt plus 1filll
......@@ -52,7 +52,7 @@ directly from within Emacs. While many fine Git clients exist, only
Magit and Git itself deserve to be called porcelains.
@noindent
This manual is for Magit version 2.13.0 (2.13.0-244-g47006165+1).
This manual is for Magit version 2.13.0 (2.13.0-292-gb768542a2+1).
@quotation
Copyright (C) 2015-2018 Jonas Bernoulli <jonas@@bernoul.li>
......@@ -4053,7 +4053,21 @@ dimmed at all depends on @code{magit-diff-highlight-hunk-region-functions}.
@defopt magit-revision-insert-related-refs
Whether to show related refs in revision buffers.
Whether to show related branches in revision buffers.
@itemize
@item
@code{nil} Don't show any related branches.
@item
@code{t} Show related local branches.
@item
@code{all} Show related local and remote branches.
@item
@code{mixed} Show all containing branches and local merged branches.
@end itemize
@end defopt
@defopt magit-revision-show-gravatar
......
......@@ -311,10 +311,18 @@ subject to option `magit-revision-insert-related-refs'."
:type 'string)
(defcustom magit-revision-insert-related-refs t
"Whether to show related refs in revision buffers."
"Whether to show related branches in revision buffers
`nil' Don't show any related branches.
`t' Show related local branches.
`all' Show related local and remote branches.
`mixed' Show all containing branches and local merged branches."
:package-version '(magit . "2.1.0")
:group 'magit-revision
:type 'boolean)
:type '(choice (const :tag "don't" nil)
(const :tag "local only" t)
(const :tag "all related" all)
(const :tag "all containing, local merged" mixed)))
(defcustom magit-revision-use-hash-sections 'quicker
"Whether to turn hashes inside the commit message into sections.
......@@ -2140,9 +2148,11 @@ or a ref which is not a branch, then it inserts nothing."
(insert (propertize hash 'face 'magit-hash))
(insert " " msg "\n")))))
(magit--insert-related-refs
rev "--merged" "Merged")
rev "--merged" "Merged"
(eq magit-revision-insert-related-refs 'all))
(magit--insert-related-refs
rev "--contains" "Contained")
rev "--contains" "Contained"
(eq magit-revision-insert-related-refs '(all mixed)))
(when-let ((follows (magit-get-current-tag rev t)))
(let ((tag (car follows))
(cnt (cadr follows)))
......@@ -2161,8 +2171,8 @@ or a ref which is not a branch, then it inserts nothing."
'face 'magit-tag))))))
(insert ?\n))))
(defun magit--insert-related-refs (rev arg title)
(when-let ((refs (magit-list-related-branches arg rev)))
(defun magit--insert-related-refs (rev arg title remote)
(when-let ((refs (magit-list-related-branches arg rev (and remote "-a"))))
(insert title ":" (make-string (- 10 (length title)) ?\s))
(dolist (branch refs)
(if (<= (+ (current-column) 1 (length branch))
......@@ -2170,7 +2180,10 @@ or a ref which is not a branch, then it inserts nothing."
(insert ?\s)
(insert ?\n (make-string 12 ?\s)))
(magit-insert-section (branch branch)
(insert (propertize branch 'face 'magit-branch-local))))
(insert (propertize branch 'face
(if (string-prefix-p "remotes/" branch)
'magit-branch-remote
'magit-branch-local)))))
(insert ?\n)))
(defun magit-insert-revision-gravatars (rev beg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment