From 30f1e7c1e93dda496412f76f70b2f49b30407b11 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Sun, 30 Oct 2022 11:43:11 +0100 Subject: Extract last source package release from local VCS data * lisp/emacs-lisp/package-vc.el (package-vc-archive-spec-alist): Unmention :release-rev (package-vc-desc->spec): Fall back on other archives if a specification is missing. (package-vc-main-file): Add new function, copying the behaviour of elpa-admin.el. (package-vc-generate-description-file): Use 'package-vc-main-file'. (package-vc-unpack): Handle special value ':last-release'. (package-vc-release-rev): Add new function using 'last-change'. (package-vc-install): Pass ':last-release' as REV instead of a release. * lisp/vc/vc-git.el (vc-git-last-change): Add Git 'last-change' implementation. * lisp/vc/vc.el (vc-default-last-change): Add default 'last-change' implementation. This attempts to replicate the behaviour of elpa-admin.el's "elpaa--get-last-release-commit". --- lisp/vc/vc.el | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lisp/vc/vc.el') diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 38209ef39ed..c8d28c144b5 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -448,6 +448,11 @@ ;; - mergebase (rev1 &optional rev2) ;; ;; Return the common ancestor between REV1 and REV2 revisions. +;; +;; - last-change (from to) +;; +;; Return the most recent revision that made a change between FROM +;; and TO. ;; TAG/BRANCH SYSTEM ;; @@ -3584,6 +3589,19 @@ it indicates a specific revision to check out." remote directory rev))) (throw 'ok res))))))) +(declare-function log-view-current-tag "log-view" (&optional pos)) +(defun vc-default-last-change (_backend from to) + "Default `last-change' implementation. +FROM and TO are used as region markers" + (save-window-excursion + (let* ((buf (window-buffer (vc-region-history from to))) + (proc (get-buffer-process buf))) + (cl-assert (processp proc)) + (while (accept-process-output proc)) + (with-current-buffer buf + (prog1 (log-view-current-tag) + (kill-buffer)))))) + ;; These things should probably be generally available -- cgit v1.2.3