aboutsummaryrefslogtreecommitdiff
path: root/guix-qa-frontpage/manage-patch-branches.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-05-15 10:13:26 +0100
committerChristopher Baines <mail@cbaines.net>2024-05-15 10:13:26 +0100
commit314e150f8eb26f811b49b03285efc54d0739aa4d (patch)
tree482c46356fa9e44da9606a11bca2f783a15d6b40 /guix-qa-frontpage/manage-patch-branches.scm
parent22f43a1e8c1d59a6038e62d33e926dfd3611d12d (diff)
downloadqa-frontpage-314e150f8eb26f811b49b03285efc54d0739aa4d.tar
qa-frontpage-314e150f8eb26f811b49b03285efc54d0739aa4d.tar.gz
Pre-compute the branch, and use the issue title as well
This allows changing the branch that QA applies the patches to by changing the title of the issue.
Diffstat (limited to 'guix-qa-frontpage/manage-patch-branches.scm')
-rw-r--r--guix-qa-frontpage/manage-patch-branches.scm67
1 files changed, 4 insertions, 63 deletions
diff --git a/guix-qa-frontpage/manage-patch-branches.scm b/guix-qa-frontpage/manage-patch-branches.scm
index c3ae256..16bfbd9 100644
--- a/guix-qa-frontpage/manage-patch-branches.scm
+++ b/guix-qa-frontpage/manage-patch-branches.scm
@@ -30,8 +30,6 @@
#:use-module (guix-qa-frontpage guix-data-service)
#:export (create-branch-for-issue
- patchwork-series->branch
-
start-manage-patch-branches-thread
get-issue-branch-base-and-target-refs))
@@ -129,64 +127,6 @@
(close-pipe pipe)
result))
-(define (parse-patch-name name)
- (let ((args
- (and
- (string-prefix? "[" name)
- (let ((stop (string-index name #\])))
- (substring name 1 stop))))
- (as-bug-number
- (lambda (arg)
- (and (string-prefix? "bug#" arg)
- (string->number (substring arg (string-length "bug#"))))))
- (as-v2
- (lambda (arg)
- (and (string-prefix? "v" arg)
- (string->number (substring arg 1)))))
- (as-patch-number
- (lambda (arg)
- (match (string-split arg #\/)
- (((= string->number index) (= string->number total))
- (and index total (<= index total)
- (cons index total)))
- (else #f)))))
- (let analyze ((bug-number #f)
- (branch "master")
- (version 1)
- (index 1)
- (total 1)
- (arguments
- (if args
- (string-split args #\,)
- '())))
- (match arguments
- ((or ("") ())
- `((bug-number . ,bug-number)
- (branch . ,branch)
- (version . ,version)
- (index . ,index)
- (total . ,total)))
- (((= as-bug-number (? number? new-bug-number))
- arguments ...)
- (analyze new-bug-number branch version index total arguments))
- (((= as-v2 (? number? new-version))
- arguments ...)
- (analyze bug-number branch new-version index total arguments))
- (((= as-patch-number ((? number? new-index) . (? number? new-total)))
- arguments ...)
- (analyze bug-number branch version new-index new-total arguments))
- ((feature-branch arguments ...)
- (analyze bug-number feature-branch version index total arguments))))))
-
-(define (patchwork-series->branch series)
- (match (assoc-ref series "patches")
- (#() "master")
- (#(first-patch rest ...)
- (let ((details
- (parse-patch-name
- (assoc-ref first-patch "name"))))
- (assq-ref details 'branch)))))
-
(define (create-branch-for-issue database issue-number patchwork-series)
(define branch-name
(simple-format #f "issue-~A" issue-number))
@@ -196,7 +136,7 @@
(define (get-base-commit)
(let ((branch
- (patchwork-series->branch patchwork-series)))
+ (assq-ref patchwork-series 'branch)))
(if (string=? branch "master")
(get-latest-processed-branch-revision "master")
@@ -424,8 +364,9 @@
(assq-ref
(get-issue-branch-base-and-target-refs issue-number)
'base))
- (branch (patchwork-series->branch
- (assq-ref all-patchwork-series issue-number))))
+ (branch
+ (assq-ref (assq-ref all-patchwork-series issue-number)
+ 'branch)))
(with-exception-handler
(lambda (exn)
(if (and (guix-data-service-error? exn)