Several improvements to the whazzup command
1. Don't report a branch if it has no commit in common with HEAD. This is for people who keep alternate histories in their repositories. 2. Don't report a branch if another branch with the same basename and commit as HEAD has already been reported. Thus, if a branch "foo" with 5 unpulled commits was pushed to origin, don't display both "foo" and "origin/foo" in the whazzup buffer, since they reflect the same thing.
This commit is contained in:
parent
e9bed9b1e2
commit
b991100ce6
1 changed files with 24 additions and 16 deletions
40
magit.el
40
magit.el
|
@ -2584,23 +2584,31 @@ Prefix arg means justify as well."
|
|||
(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-")))
|
||||
(let ((branches (magit-git-lines "branch -a | cut -c3-"))
|
||||
(reported (make-hash-table :test #'equal)))
|
||||
(dolist (b branches)
|
||||
(let* ((n (magit-git-string "log --pretty=oneline %s..%s | wc -l"
|
||||
head b))
|
||||
(section
|
||||
(let ((magit-section-hidden-default t))
|
||||
(magit-git-section
|
||||
(cons b 'wazzup)
|
||||
(format "%s unmerged commits in %s"
|
||||
n b)
|
||||
'magit-wash-log
|
||||
"log"
|
||||
(format "--max-count=%s" magit-log-cutoff-length)
|
||||
"--pretty=oneline"
|
||||
(format "%s..%s" head b)
|
||||
"--"))))
|
||||
(magit-set-section-info b section)))))))
|
||||
(let* ((hash (magit-git-string "rev-parse %s" b))
|
||||
(reported-branch (gethash hash reported)))
|
||||
(unless (or (and reported-branch
|
||||
(string= (file-name-nondirectory b)
|
||||
reported-branch))
|
||||
(not (magit-git-string "merge-base %s %s" head b)))
|
||||
(puthash hash (file-name-nondirectory b) reported)
|
||||
(let* ((n (magit-git-string "log --pretty=oneline %s..%s | wc -l"
|
||||
head b))
|
||||
(section
|
||||
(let ((magit-section-hidden-default t))
|
||||
(magit-git-section
|
||||
(cons b 'wazzup)
|
||||
(format "%s unmerged commits in %s"
|
||||
n b)
|
||||
'magit-wash-log
|
||||
"log"
|
||||
(format "--max-count=%s" magit-log-cutoff-length)
|
||||
"--pretty=oneline"
|
||||
(format "%s..%s" head b)
|
||||
"--"))))
|
||||
(magit-set-section-info b section)))))))))
|
||||
|
||||
(defun magit-wazzup ()
|
||||
(interactive)
|
||||
|
|
Loading…
Reference in a new issue