unofficial mirror of 
 help / color / mirror / code / Atom feed
From: Vivien Kraus <>
Cc: Christopher Baines <>
Subject: [PATCH qa-frontpage] Sort the patches before applying them to the git branch.
Date: Tue, 31 Oct 2023 21:01:10 +0100	[thread overview]
Message-ID: <> (raw)

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

                 reply	other threads:[~2023-10-31 20:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).