diff options
| author | Marius Vollmer <marius.vollmer@gmail.com> | 2009-03-08 14:41:52 +0200 |
|---|---|---|
| committer | Marius Vollmer <marius.vollmer@gmail.com> | 2009-03-08 14:42:55 +0200 |
| commit | 5c7b6b2efee4c1e5329a2a74962f034f15e653a6 (patch) | |
| tree | d430ec1d658e3e04745a0043b91258026e31c418 | |
| parent | d9f86642ecc5a4821c818484ea3ca67f08ed0d27 (diff) | |
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.
| -rw-r--r-- | magit.el | 22 | ||||
| -rw-r--r-- | magit.texi | 3 |
2 files changed, 20 insertions, 5 deletions
@@ -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) @@ -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 |
