summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2020-04-16 23:49:40 -0400
committerKyle Meyer <kyle@kyleam.com>2020-04-16 23:54:15 -0400
commit8decfccd37b9a0d2d88695cebaef1a5d3f96b4d0 (patch)
treeaeb9031569dff8365968d7d1d7e87b16528d16a5
parent559288e7099f8bc4db0d7a415da449c754326b5b (diff)
downloademacs.d-8decfccd37b9a0d2d88695cebaef1a5d3f96b4d0.tar.gz
km-magit: Add command to create dedicated log for a topic branch
-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)