summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/km-magit.el19
1 files changed, 19 insertions, 0 deletions
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)