blob: 1058410c45ab20004f6cdbad503e6620efbca178 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
;; -*- lexical-binding: t; -*-
(require 'buildbot-client)
(require 'buildbot-view)
(define-derived-mode buildbot-step-mode buildbot-view-mode "Buildbot step"
"Buildbot view for a step")
(defvar-local buildbot-step-revision-info nil)
(defvar-local buildbot-step-build nil)
(defvar-local buildbot-step-step nil)
(defun buildbot-step-buffer-name (stepid)
(concat "*buildbot step " (number-to-string stepid) "*"))
(defun buildbot-step-load (revision-info build step)
(let ((buffer-name (buildbot-step-buffer-name (alist-get 'stepid step))))
(with-current-buffer (get-buffer-create buffer-name)
(buildbot-step-mode)
(setq buildbot-step-revision-info revision-info
buildbot-step-build build
buildbot-step-step step)
(buildbot-step-update))
(switch-to-buffer buffer-name)))
(defun buildbot-step-update ()
(unless (derived-mode-p 'buildbot-step-mode)
(error "Not in buildbot step mode"))
(let ((inhibit-read-only t))
(erase-buffer)
(let ((logs (buildbot-get-logs-by-stepid
(alist-get 'stepid buildbot-step-step))))
(insert (buildbot-step-format
buildbot-step-revision-info
buildbot-step-build
buildbot-step-step
logs))
(goto-char (point-min)))))
(defun buildbot-step-reload ()
(interactive)
(buildbot-step-update))
(define-key buildbot-step-mode-map "g" 'buildbot-step-reload)
(defun buildbot-step-format (revision-info build step logs)
(concat
(buildbot-view-format-revision-info revision-info)
"\n"
(buildbot-view-format-build build)
"\n"
(buildbot-view-format-step step)
(string-join
(mapcar 'buildbot-view-format-log logs)
"\n")))
(provide 'buildbot-step)
|