From 8decfccd37b9a0d2d88695cebaef1a5d3f96b4d0 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Thu, 16 Apr 2020 23:49:40 -0400 Subject: km-magit: Add command to create dedicated log for a topic branch --- lisp/km-magit.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lisp/km-magit.el b/lisp/km-magit.el index 38fe1cb..3ec0289 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -710,6 +710,25 @@ argument. Interactively, this can be accessed using the command (magit-log-goto-same-commit) (current-buffer))) +;;;###autoload +(defun km/magit-log-topic (branch) + "Run `git log --reverse [...] @{upstream}..BRANCH'." + (interactive (list (magit-read-branch "Topic branch"))) + (with-current-buffer + (magit-log-setup-buffer + (list (format "%s..%s" + (or (let ((upstream (concat branch "@{u}"))) + (and (magit-rev-verify upstream) + upstream)) + "master") + branch)) + (let ((args (car (magit-log-arguments)))) + (cl-pushnew "--reverse" args) + args) + nil t) + ;; Could avoid `magit-log-setup-buffer', but this is good enough. + (goto-char (point-min)))) + (defun km/magit-cherry-dwim () (interactive) (-let [(head . upstream) -- cgit v1.2.3