aboutsummaryrefslogtreecommitdiff
path: root/buildbot-view.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-07-15 16:30:54 +1000
committerYuchen Pei <id@ypei.org>2023-07-15 16:30:54 +1000
commit6583303218c19c394eac34a792e4a326e1c19b0d (patch)
treec33e31d1cc2494f2be372fad923a8afd94866990 /buildbot-view.el
parent69a087571aa807008ba2f792926a2bda29d524bb (diff)
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.
Diffstat (limited to 'buildbot-view.el')
-rw-r--r--buildbot-view.el34
1 files changed, 28 insertions, 6 deletions
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)))