From 8beace1101eef42a5231ee390bea0a1ca4497414 Mon Sep 17 00:00:00 2001 From: Jonas Bernoulli Date: Sun, 14 Jun 2020 15:35:01 +0200 Subject: [PATCH] forge--pullreq-range: New function Prefer the remote-tracking branch as that is more likely to be up-to-date. The `endpoints' argument is for when the range is to be used to show a diff. From git-diff(1): > "diff" is about comparing two endpoints, not ranges, and the range > notations (".." and "...") do not > mean a range as defined in the "SPECIFYING RANGES" section in > gitrevisions(7). --- lisp/forge-pullreq.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/forge-pullreq.el b/lisp/forge-pullreq.el index c553f0db..e47c2fcf 100644 --- a/lisp/forge-pullreq.el +++ b/lisp/forge-pullreq.el @@ -199,6 +199,12 @@ yourself, in which case you probably should not reset either. (let ((ref (format "refs/pullreqs/%s" (oref pullreq number)))) (and (magit-rev-verify ref) ref))) +(defun forge--pullreq-range (pullreq &optional endpoints) + (when-let ((head (forge--pullreq-ref pullreq))) + (concat (forge--get-remote) "/" (oref pullreq base-ref) + (if endpoints "..." "..") + head))) + (cl-defmethod forge-get-url ((pullreq forge-pullreq)) (forge--format pullreq 'pullreq-url-format)) @@ -245,11 +251,10 @@ Also see option `forge-topic-list-limit'." (forge--topic-type-prefix repo 'pullreq))))) (defun forge--insert-pullreq-commits (pullreq) - (when-let ((ref (forge--pullreq-ref pullreq))) + (when-let ((range (forge--pullreq-range pullreq))) (magit-insert-section-body (cl-letf (((symbol-function #'magit-cancel-section) (lambda ()))) - (magit-insert-log (format "%s..%s" (oref pullreq base-ref) ref) - magit-buffer-log-args) + (magit-insert-log range magit-buffer-log-args) (magit-make-margin-overlay nil t))))) (cl-defmethod forge--insert-topic-contents :after ((pullreq forge-pullreq)