From 6583303218c19c394eac34a792e4a326e1c19b0d Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 15 Jul 2023 16:30:54 +1000 Subject: Adding support for more instances - Pass buildbot-host between buffers - Set buildbot-builders automatically - When the Changes API does not return builds, fetch the builds in a separate call This last change allows `buildbot-revision-open' to work with more instances, including python and buildbot. Also updated README with these changes, as well as ELPA installation info. --- buildbot-view.el | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'buildbot-view.el') diff --git a/buildbot-view.el b/buildbot-view.el index 323d3bc..1db4b87 100644 --- a/buildbot-view.el +++ b/buildbot-view.el @@ -128,10 +128,12 @@ (defun buildbot-view-format-build-stats (stats) "Format build STATS in the view." - (format "Build stats: Success - %d | Failure - %d | Pending - %d" - (alist-get 'success stats) - (alist-get 'failure stats) - (alist-get 'pending stats))) + (if stats + (format "Build stats: Success - %d | Failure - %d | Pending - %d" + (alist-get 'success stats) + (alist-get 'failure stats) + (alist-get 'pending stats)) + "Build stats: Unknown")) (defun buildbot-view-format-build (revision build &optional show-revision) "Format a BUILD header associated with REVISION in the view. @@ -305,6 +307,22 @@ With a non-nil NO-BRANCH, do not show branch info." ('log (format "*buildbot log %d*" (alist-get 'logid (alist-get 'log data)))))) +(defun buildbot-builders-same-host (host) + "Get `buildbot-builders' from a buffer with HOST. + +Find the first `buildbot-view-mode' buffer whose `buildbot-host' +has value HOST and whose `buildbot-builders' is nonnil, and +return `buildbot-builders' from that buffer." + (when-let ((found-buffer + (cl-find-if + (lambda (buffer) + (with-current-buffer buffer + (and (derived-mode-p 'buildbot-view-mode) + (equal buildbot-host host) + buildbot-builders))) + (buffer-list)))) + (buffer-local-value 'buildbot-builders found-buffer))) + (defun buildbot-view-open (type data &optional force) "Open a view of TYPE using DATA. @@ -317,8 +335,12 @@ With a non-nil FORCE, reload the view buffer if exists." (buildbot-view-mode) (setq buildbot-view-type type buildbot-view-data data - buildbot-host host - buildbot-builders builders) + buildbot-host + (or host buildbot-default-host) + buildbot-builders + (or builders + (buildbot-builders-same-host buildbot-host) + (buildbot-get-all-builders))) (buildbot-view-update))) (switch-to-buffer buffer-name))) -- cgit v1.2.3