unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Vivien Kraus <vivien@planete-kraus.eu>
To: guix-devel@gnu.org
Cc: Christopher Baines <mail@cbaines.net>
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: <560ddb89da85b85c75362739f42c39a215ea47a4.1698782989.git.vivien@planete-kraus.eu> (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
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	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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=560ddb89da85b85c75362739f42c39a215ea47a4.1698782989.git.vivien@planete-kraus.eu \
    --to=vivien@planete-kraus.eu \
    --cc=guix-devel@gnu.org \
    --cc=mail@cbaines.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/guix.git

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