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-create-buffer-sections
|
||||||
(magit-with-section 'wazzupbuf nil
|
(magit-with-section 'wazzupbuf nil
|
||||||
(insert (format "Wazzup, %s\n\n" head))
|
(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)
|
(dolist (b branches)
|
||||||
(let* ((n (magit-git-string "log --pretty=oneline %s..%s | wc -l"
|
(let* ((hash (magit-git-string "rev-parse %s" b))
|
||||||
head b))
|
(reported-branch (gethash hash reported)))
|
||||||
(section
|
(unless (or (and reported-branch
|
||||||
(let ((magit-section-hidden-default t))
|
(string= (file-name-nondirectory b)
|
||||||
(magit-git-section
|
reported-branch))
|
||||||
(cons b 'wazzup)
|
(not (magit-git-string "merge-base %s %s" head b)))
|
||||||
(format "%s unmerged commits in %s"
|
(puthash hash (file-name-nondirectory b) reported)
|
||||||
n b)
|
(let* ((n (magit-git-string "log --pretty=oneline %s..%s | wc -l"
|
||||||
'magit-wash-log
|
head b))
|
||||||
"log"
|
(section
|
||||||
(format "--max-count=%s" magit-log-cutoff-length)
|
(let ((magit-section-hidden-default t))
|
||||||
"--pretty=oneline"
|
(magit-git-section
|
||||||
(format "%s..%s" head b)
|
(cons b 'wazzup)
|
||||||
"--"))))
|
(format "%s unmerged commits in %s"
|
||||||
(magit-set-section-info b section)))))))
|
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 ()
|
(defun magit-wazzup ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
Loading…
Reference in a new issue