guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH qa-frontpage] Sort the patches before applying them to the git br


From: Vivien Kraus
Subject: [PATCH qa-frontpage] Sort the patches before applying them to the git branch.
Date: Tue, 31 Oct 2023 21:01:10 +0100
User-agent: Evolution 3.46.4

By default, the patches are not ordered.  Because of the unreliability
of e-mail delivery, they can be received completely out of order.
Patchwork may also re-order them, and they may get ordered by commit
author date (or, equivalently, e-mail Date header).  Both
possibilities lead to failure to apply patches if the order is
incorrect for two patches that do not commute.

The patch name contains a header: [bug#xxx,v12,i/n] where "i" is the
variable part and indicates the patch number. Git pads "i" with zeros
if needed. The string order of the names is thus the true commit
order.

* guix-qa-frontpage/manage-patch-branches.scm (create-branch-for-issue):
Sort patches according to their "name".
---
 guix-qa-frontpage/manage-patch-branches.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/guix-qa-frontpage/manage-patch-branches.scm 
b/guix-qa-frontpage/manage-patch-branches.scm
index a42f3a0..74d7b8b 100644
--- a/guix-qa-frontpage/manage-patch-branches.scm
+++ b/guix-qa-frontpage/manage-patch-branches.scm
@@ -243,8 +243,13 @@
            (invoke-read-line "git" "show-ref" "--hash" base-tag)))
 
       (let loop ((patch-data
-                  (vector->list
-                   (assoc-ref patchwork-series "patches")))
+                  (stable-sort
+                   (vector->list
+                    (assoc-ref patchwork-series "patches"))
+                   (lambda (patch-a patch-b)
+                     (let ((name-a (assoc-ref patch-a "name"))
+                           (name-b (assoc-ref patch-b "name")))
+                       (string<? name-a name-b)))))
                  (results '()))
         (if (null? patch-data)
             (begin

base-commit: 074b856b01202c74a86846278adf1a7bbcc41cb9
-- 
2.41.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]