From 3857ce227ad4195837957f50727e7a29c73b394f Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Sun, 1 Mar 2009 21:26:41 +0200 Subject: [PATCH] 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. --- magit.el | 32 +++++++++++++++++++++++--------- magit.texi | 4 ++++ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/magit.el b/magit.el index 08837f9b..adc531a7 100644 --- a/magit.el +++ b/magit.el @@ -2671,12 +2671,23 @@ Prefix arg means justify as well." ;;; 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-with-section 'wazzupbuf nil (insert (format "Wazzup, %s\n\n" head)) - (let ((branches (magit-git-lines "branch -a | cut -c3-")) - (reported (make-hash-table :test #'equal))) + (let* ((excluded (magit-file-lines ".git/info/wazzup-exclude")) + (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) (let* ((hash (magit-git-string "rev-parse %s" b)) (reported-branch (gethash hash reported))) @@ -2691,8 +2702,11 @@ Prefix arg means justify as well." (let ((magit-section-hidden-default t)) (magit-git-section (cons b 'wazzup) - (format "%s unmerged commits in %s" - n b) + (format "%s unmerged commits in %s%s" + n b + (if (member b excluded) + " (normally ignored)" + "")) 'magit-wash-log "log" (format "--max-count=%s" magit-log-cutoff-length) @@ -2701,13 +2715,13 @@ Prefix arg means justify as well." "--")))) (magit-set-section-info b section))))))))) -(defun magit-wazzup () - (interactive) +(defun magit-wazzup (&optional all) + (interactive "P") (let* ((topdir (magit-get-top-dir default-directory))) (switch-to-buffer "*magit-wazzup*") (magit-mode-init topdir 'wazzup #'magit-refresh-wazzup-buffer - (magit-get-current-branch)))) + (magit-get-current-branch) all))) ;;; Miscellaneous @@ -2724,7 +2738,7 @@ Prefix arg means justify as well." ((untracked file) (magit-ignore-file info current-prefix-arg nil)) ((wazzup) - (message "wazzup")))) + (magit-wazzup-ignore info current-prefix-arg)))) (defun magit-ignore-item-locally () (interactive) diff --git a/magit.texi b/magit.texi index 51b28a13..4793cd3f 100644 --- a/magit.texi +++ b/magit.texi @@ -445,6 +445,10 @@ similar) to show the lists of commits. When point is on a @emph{N unmerged commits in ...} title, the 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 @chapter Merging