aboutsummaryrefslogtreecommitdiff
path: root/buildbot-revision.el
diff options
context:
space:
mode:
Diffstat (limited to 'buildbot-revision.el')
-rw-r--r--buildbot-revision.el53
1 files changed, 40 insertions, 13 deletions
diff --git a/buildbot-revision.el b/buildbot-revision.el
index 4f8ad57..08ba7b1 100644
--- a/buildbot-revision.el
+++ b/buildbot-revision.el
@@ -2,6 +2,7 @@
(require 'buildbot-client)
(defvar-local buildbot-revision-revision-id nil)
+(defvar-local buildbot-revision-info nil)
(defvar buildbot-revision-header-regex "^\\[.*\\]$")
(define-derived-mode buildbot-revision-mode special-mode "Buildbot revision"
@@ -25,7 +26,13 @@
(error "Not in buildbot revision mode"))
(let ((inhibit-read-only t))
(erase-buffer)
- (insert (buildbot-revision-format buildbot-revision-revision-id))))
+ (let ((change
+ (buildbot-get-change-by-revision buildbot-revision-revision-id)))
+ (setq buildbot-revision-info
+ (buildbot-revision-get-info change))
+ (insert (buildbot-revision-format buildbot-revision-info
+ (alist-get 'builds change)))
+ (goto-char (point-min)))))
(defun buildbot-revision-open (revision)
(interactive "sRevision (commit hash): ")
@@ -35,11 +42,29 @@
(interactive)
(buildbot-revision-update))
-(defun buildbot-revision-format (revision)
- (string-join
- (mapcar 'buildbot-revision-format-build
- (buildbot-get-builds-by-revision revision))
- "\n"))
+(defun buildbot-revision-format (revision-info builds)
+ (concat
+ (buildbot-revision-format-info revision-info)
+ "\n"
+ (string-join
+ (mapcar 'buildbot-revision-format-build builds)
+ "\n")))
+
+(defun buildbot-revision-get-info (change)
+ (list (cons 'revision (alist-get 'revision change))
+ (cons 'author (alist-get 'author change))
+ (cons 'created-at (buildbot-format-epoch-time
+ (alist-get 'created_at
+ (alist-get 'sourcestamp change))))
+ (cons 'comments (alist-get 'comments change))))
+
+(defun buildbot-revision-format-info (info)
+ (format
+ "commit %s\nAuthor: %s\nDate: %s\n\n%s"
+ (alist-get 'revision info)
+ (alist-get 'author info)
+ (alist-get 'created-at info)
+ (alist-get 'comments info)))
(defun buildbot-revision-next-header (n)
(interactive "p")
@@ -59,12 +84,14 @@
(define-key buildbot-revision-mode-map "p" 'buildbot-revision-previous-header)
(defun buildbot-revision-format-build (build)
- (format "[%s %s]\n%s\n"
- (buildbot-get-builder-name-by-id (alist-get 'builderid build))
- (alist-get 'state_string build)
- (string-join
- (mapcar (lambda (test) (alist-get 'test_name test))
- (alist-get 'failed_tests build))
- "\n")))
+ (propertize
+ (format "\n[%s %s]\n%s"
+ (buildbot-get-builder-name-by-id (alist-get 'builderid build))
+ (alist-get 'state_string build)
+ (string-join
+ (mapcar (lambda (test) (alist-get 'test_name test))
+ (alist-get 'failed_tests build))
+ "\n"))
+ 'buildid (alist-get 'id build)))
(provide 'buildbot-revision)