If wazzup head is detached then describe it so.

This commit is contained in:
Phil Jackson 2010-03-29 21:21:09 +01:00
parent c51582ee17
commit 33ea60d690

View file

@ -3320,45 +3320,46 @@ Prefix arg means justify as well."
(magit-need-refresh)))) (magit-need-refresh))))
(defun magit-refresh-wazzup-buffer (head all) (defun magit-refresh-wazzup-buffer (head all)
(unless head (setq head "HEAD")) (let ((branch-desc (or head "(detached) HEAD")))
(magit-create-buffer-sections (unless head (setq head "HEAD"))
(magit-with-section 'wazzupbuf nil (magit-create-buffer-sections
(insert (format "Wazzup, %s\n\n" head)) (magit-with-section 'wazzupbuf nil
(let* ((excluded (magit-file-lines ".git/info/wazzup-exclude")) (insert (format "Wazzup, %s\n\n" branch-desc))
(all-branches (magit-list-interesting-refs)) (let* ((excluded (magit-file-lines ".git/info/wazzup-exclude"))
(branches (if all all-branches (all-branches (magit-list-interesting-refs))
(branches (if all all-branches
(remove-if (lambda (b) (member (cdr b) excluded)) (remove-if (lambda (b) (member (cdr b) excluded))
all-branches))) all-branches)))
(reported (make-hash-table :test #'equal))) (reported (make-hash-table :test #'equal)))
(dolist (branch branches) (dolist (branch branches)
(let* ((name (car branch)) (let* ((name (car branch))
(ref (cdr branch)) (ref (cdr branch))
(hash (magit-git-string "rev-parse" ref)) (hash (magit-git-string "rev-parse" ref))
(reported-branch (gethash hash reported))) (reported-branch (gethash hash reported)))
(unless (or (and reported-branch (unless (or (and reported-branch
(string= (file-name-nondirectory ref) (string= (file-name-nondirectory ref)
reported-branch)) reported-branch))
(not (magit-git-string "merge-base" head ref))) (not (magit-git-string "merge-base" head ref)))
(puthash hash (file-name-nondirectory ref) reported) (puthash hash (file-name-nondirectory ref) reported)
(let* ((n (length (magit-git-lines "log" "--pretty=oneline" (let* ((n (length (magit-git-lines "log" "--pretty=oneline"
(concat head ".." ref)))) (concat head ".." ref))))
(section (section
(let ((magit-section-hidden-default t)) (let ((magit-section-hidden-default t))
(magit-git-section (magit-git-section
(cons ref 'wazzup) (cons ref 'wazzup)
(format "%s unmerged commits in %s%s" (format "%s unmerged commits in %s%s"
n name n name
(if (member ref excluded) (if (member ref excluded)
" (normally ignored)" " (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)
"--graph" "--graph"
"--pretty=oneline" "--pretty=oneline"
(format "%s..%s" head ref) (format "%s..%s" head ref)
"--")))) "--"))))
(magit-set-section-info ref section))))))))) (magit-set-section-info ref section))))))))))
(defun magit-wazzup (&optional all) (defun magit-wazzup (&optional all)
(interactive "P") (interactive "P")