Make 'i' toggle the ignore flag for wazzup.

* magit.el (magit-write-file-lines): New.
(magit-wazzup-toggle-ignore): New, use it instead of magit-wazzup-ignore.
* magit.texi: Document it.
This commit is contained in:
Marius Vollmer 2009-03-08 14:41:52 +02:00
parent d9f86642ec
commit 5c7b6b2efe
2 changed files with 20 additions and 5 deletions

View file

@ -42,6 +42,7 @@
;;
;; Later:
;;
;; - Queuing of asynchronous commands.
;; - Good email integration.
;; - Showing tags.
;; - Visiting from staged hunks doesn't always work since the line
@ -266,6 +267,12 @@ Many Magit faces inherit from this one by default."
(cdr rev)
rev))))))
(defun magit-write-file-lines (file lines)
(with-temp-buffer
(dolist (l lines)
(insert l "\n"))
(write-file file)))
(defun magit-concat-with-delim (delim seqs)
(cond ((null seqs)
nil)
@ -2682,12 +2689,19 @@ Prefix arg means justify as well."
;;; Wazzup
(defun magit-wazzup-ignore (branch edit)
(defun magit-wazzup-toggle-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)))
(let ((ignored (magit-file-lines ignore-file)))
(cond ((member branch ignored)
(when (or (not edit)
(y-or-n-p "Branch %s is already ignored. Unignore?"))
(setq ignored (delete branch ignored))))
(t
(setq ignored (append ignored (list branch)))))
(magit-write-file-lines ignore-file ignored)
(magit-need-refresh))))
(defun magit-refresh-wazzup-buffer (head all)
(magit-create-buffer-sections
@ -2749,7 +2763,7 @@ Prefix arg means justify as well."
((untracked file)
(magit-ignore-file info current-prefix-arg nil))
((wazzup)
(magit-wazzup-ignore info current-prefix-arg))))
(magit-wazzup-toggle-ignore info current-prefix-arg))))
(defun magit-ignore-item-locally ()
(interactive)

View file

@ -447,7 +447,8 @@ 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.
the ignored ones. Hitting @kbd{i} on an already ignored branch in
that view will unignore it.
@node Merging
@chapter Merging