blob: 9e3d913a68cd27bccf83bb1cb83362da72ce05da (
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
55
56
57
58
59
60
61
|
;; -*- lexical-binding: t; -*-
(require 'buildbot-client)
(require 'buildbot-view)
(define-derived-mode buildbot-build-mode buildbot-view-mode "Buildbot build"
"Buildbot view for a build")
(defvar-local buildbot-build-build nil)
(defvar-local buildbot-build-revision-info nil)
(defun buildbot-build-buffer-name (buildid)
(concat "*buildbot build " (number-to-string buildid) "*"))
(defun buildbot-build-load (build revision-info)
(let ((buffer-name (buildbot-build-buffer-name (alist-get 'id build))))
(with-current-buffer (get-buffer-create buffer-name)
(buildbot-build-mode)
(setq buildbot-build-build build
buildbot-build-revision-info revision-info)
(buildbot-build-update))
(switch-to-buffer buffer-name)))
(defun buildbot-build-update ()
(unless (derived-mode-p 'buildbot-build-mode)
(error "Not in buildbot build mode"))
(let ((inhibit-read-only t))
(erase-buffer)
(let ((steps (buildbot-get-steps-by-buildid
(alist-get 'id buildbot-build-build))))
(insert (buildbot-build-format
buildbot-build-revision-info
buildbot-build-build
steps))
(goto-char (point-min)))))
(defun buildbot-build-reload ()
(interactive)
(buildbot-build-update))
(define-key buildbot-build-mode-map "g" 'buildbot-build-reload)
(defun buildbot-build-format (revision-info build steps)
(concat
(buildbot-view-format-revision-info revision-info)
"\n"
(buildbot-view-format-build build)
"\n"
(string-join
(mapcar 'buildbot-view-format-step steps)
"\n")))
(defun buildbot-build-open-step ()
(interactive)
(let ((step (get-text-property (point) 'step)))
(unless step
(error "Not at a step"))
(buildbot-step-load buildbot-build-revision-info
buildbot-build-build
step)))
(define-key buildbot-build-mode-map (kbd "<return>")
'buildbot-build-open-step)
(provide 'buildbot-build)
|