Allow ignoring of branches in the Wazzup view.
* magit.el (magit-wazzup-ignore): New. (magit-refresh-wazzup-buffer): Read wazzup-exclude and optionally omit the branches listed in it. Added 'all' parameter to control this. (magit-wazzup): Show all branches with prefix. (magit-ignore-item): Call magit-wazzup-ignore for wazzup branches. * magit.texi: Document it.
This commit is contained in:
parent
2fcdd916b9
commit
3857ce227a
2 changed files with 27 additions and 9 deletions
32
magit.el
32
magit.el
|
@ -2671,12 +2671,23 @@ Prefix arg means justify as well."
|
||||||
|
|
||||||
;;; Wazzup
|
;;; Wazzup
|
||||||
|
|
||||||
(defun magit-refresh-wazzup-buffer (head)
|
(defun magit-wazzup-ignore (branch edit)
|
||||||
|
(let ((ignore-file ".git/info/wazzup-exclude"))
|
||||||
|
(if edit
|
||||||
|
(setq branch (read-string "Branch to ignore for wazzup: " branch)))
|
||||||
|
(append-to-file (concat branch "\n") nil ignore-file)
|
||||||
|
(magit-need-refresh)))
|
||||||
|
|
||||||
|
(defun magit-refresh-wazzup-buffer (head all)
|
||||||
(magit-create-buffer-sections
|
(magit-create-buffer-sections
|
||||||
(magit-with-section 'wazzupbuf nil
|
(magit-with-section 'wazzupbuf nil
|
||||||
(insert (format "Wazzup, %s\n\n" head))
|
(insert (format "Wazzup, %s\n\n" head))
|
||||||
(let ((branches (magit-git-lines "branch -a | cut -c3-"))
|
(let* ((excluded (magit-file-lines ".git/info/wazzup-exclude"))
|
||||||
(reported (make-hash-table :test #'equal)))
|
(all-branches (magit-git-lines "branch -a | cut -c3-"))
|
||||||
|
(branches (if all all-branches
|
||||||
|
(remove-if (lambda (b) (member b excluded))
|
||||||
|
all-branches)))
|
||||||
|
(reported (make-hash-table :test #'equal)))
|
||||||
(dolist (b branches)
|
(dolist (b branches)
|
||||||
(let* ((hash (magit-git-string "rev-parse %s" b))
|
(let* ((hash (magit-git-string "rev-parse %s" b))
|
||||||
(reported-branch (gethash hash reported)))
|
(reported-branch (gethash hash reported)))
|
||||||
|
@ -2691,8 +2702,11 @@ Prefix arg means justify as well."
|
||||||
(let ((magit-section-hidden-default t))
|
(let ((magit-section-hidden-default t))
|
||||||
(magit-git-section
|
(magit-git-section
|
||||||
(cons b 'wazzup)
|
(cons b 'wazzup)
|
||||||
(format "%s unmerged commits in %s"
|
(format "%s unmerged commits in %s%s"
|
||||||
n b)
|
n b
|
||||||
|
(if (member b excluded)
|
||||||
|
" (normally ignored)"
|
||||||
|
""))
|
||||||
'magit-wash-log
|
'magit-wash-log
|
||||||
"log"
|
"log"
|
||||||
(format "--max-count=%s" magit-log-cutoff-length)
|
(format "--max-count=%s" magit-log-cutoff-length)
|
||||||
|
@ -2701,13 +2715,13 @@ Prefix arg means justify as well."
|
||||||
"--"))))
|
"--"))))
|
||||||
(magit-set-section-info b section)))))))))
|
(magit-set-section-info b section)))))))))
|
||||||
|
|
||||||
(defun magit-wazzup ()
|
(defun magit-wazzup (&optional all)
|
||||||
(interactive)
|
(interactive "P")
|
||||||
(let* ((topdir (magit-get-top-dir default-directory)))
|
(let* ((topdir (magit-get-top-dir default-directory)))
|
||||||
(switch-to-buffer "*magit-wazzup*")
|
(switch-to-buffer "*magit-wazzup*")
|
||||||
(magit-mode-init topdir 'wazzup
|
(magit-mode-init topdir 'wazzup
|
||||||
#'magit-refresh-wazzup-buffer
|
#'magit-refresh-wazzup-buffer
|
||||||
(magit-get-current-branch))))
|
(magit-get-current-branch) all)))
|
||||||
|
|
||||||
;;; Miscellaneous
|
;;; Miscellaneous
|
||||||
|
|
||||||
|
@ -2724,7 +2738,7 @@ Prefix arg means justify as well."
|
||||||
((untracked file)
|
((untracked file)
|
||||||
(magit-ignore-file info current-prefix-arg nil))
|
(magit-ignore-file info current-prefix-arg nil))
|
||||||
((wazzup)
|
((wazzup)
|
||||||
(message "wazzup"))))
|
(magit-wazzup-ignore info current-prefix-arg))))
|
||||||
|
|
||||||
(defun magit-ignore-item-locally ()
|
(defun magit-ignore-item-locally ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
|
@ -445,6 +445,10 @@ similar) to show the lists of commits.
|
||||||
When point is on a @emph{N unmerged commits in ...} title, the
|
When point is on a @emph{N unmerged commits in ...} title, the
|
||||||
corresponding branch will be offered as the default for a merge.
|
corresponding branch will be offered as the default for a merge.
|
||||||
|
|
||||||
|
Hitting @kbd{i} on a branch title will ignore this branch in the
|
||||||
|
wazzup view. You can use @kbd{C-u w} to show all branches, including
|
||||||
|
the ignored ones.
|
||||||
|
|
||||||
@node Merging
|
@node Merging
|
||||||
@chapter Merging
|
@chapter Merging
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue