unofficial mirror of 
 help / color / mirror / code / Atom feed
* [PATCH qa-frontpage] Sort the patches before applying them to the git branch.
@ 2023-10-31 20:01 Vivien Kraus
  0 siblings, 0 replies; only message in thread
From: Vivien Kraus @ 2023-10-31 20:01 UTC (permalink / raw)
  To: guix-devel; +Cc: Christopher Baines

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

* 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)

base-commit: 074b856b01202c74a86846278adf1a7bbcc41cb9

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-31 20:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 20:01 [PATCH qa-frontpage] Sort the patches before applying them to the git branch Vivien Kraus

Code repositories for project(s) associated with this public inbox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).