Commit dae91251 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit--insert-related-refs: New function

parent d512f92a
......@@ -2139,32 +2139,10 @@ or a ref which is not a branch, then it inserts nothing."
(insert "Parent: ")
(insert (propertize hash 'face 'magit-hash))
(insert " " msg "\n")))))
(when-let ((merged (magit-list-merged-branches rev)))
(insert "Merged: ")
(let (branch)
(while (and (< (+ (- (point) (line-beginning-position))
(length (car merged)) 9)
(window-width))
(setq branch (pop merged)))
(insert ?\s)
(magit-insert-section (branch branch)
(insert (propertize branch 'face 'magit-branch-local)))))
(when merged
(insert (format " (%s more)" (length merged))))
(insert ?\n))
(when-let ((containing (magit-list-containing-branches rev)))
(insert "Containing:")
(let (branch)
(while (and (< (+ (- (point) (line-beginning-position))
(length (car containing)) 9)
(window-width))
(setq branch (pop containing)))
(insert ?\s)
(magit-insert-section (branch branch)
(insert (propertize branch 'face 'magit-branch-local)))))
(when containing
(insert (format " (%s more)" (length containing))))
(insert ?\n))
(magit--insert-related-refs
rev "--merged" "Merged")
(magit--insert-related-refs
rev "--contains" "Contained")
(when-let ((follows (magit-get-current-tag rev t)))
(let ((tag (car follows))
(cnt (cadr follows)))
......@@ -2183,6 +2161,21 @@ 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)))
(insert title ":" (make-string (- 10 (length title)) ?\s))
(let (branch)
(while (and (< (+ (- (point) (line-beginning-position))
(length (car refs)) 9)
(window-width))
(setq branch (pop refs)))
(insert ?\s)
(magit-insert-section (branch branch)
(insert (propertize branch 'face 'magit-branch-local)))))
(when refs
(insert (format " (%s more)" (length refs))))
(insert ?\n)))
(defun magit-insert-revision-gravatars (rev beg)
(when (and magit-revision-show-gravatars
(window-system))
......
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