emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] elpa-admin 2250e2e4ea: (elpaa--get-release-revision): Tweak heuri


From: Stefan Monnier
Subject: [elpa] elpa-admin 2250e2e4ea: (elpaa--get-release-revision): Tweak heuristic for `:merge`
Date: Tue, 25 Oct 2022 22:27:51 -0400 (EDT)

branch: elpa-admin
commit 2250e2e4eace6b96bc922509ecca97e4d436474f
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (elpaa--get-release-revision): Tweak heuristic for `:merge`
    
    * elpa-admin.el (elpaa--get-release-revision): Use `--first-parent`
    for packages sync'd with `:merge`.
    (elpaa--call): Skip nil args.
    (elpaa--push): Simplify accordingly.
---
 README        |  5 +++++
 elpa-admin.el | 32 +++++++++++++++++++++-----------
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/README b/README
index a61c4f2b59..6a1244169d 100644
--- a/README
+++ b/README
@@ -174,6 +174,11 @@ merges instead of fast-forwards.
 This only works for the main branch, not for the release branch.
 An unnecessary =:merge= setting is considered as an error.
 
+This option has many shortcomings, so its use is discouraged: it is
+better avoided as much as possible.  Among other problems,  merges
+don't interact well with the algorithm used to determine which
+revision is a "release".
+
 * Configuration (elpa-config)
 
 The configuration file is a `lisp-data-mode` file containing
diff --git a/elpa-admin.el b/elpa-admin.el
index ab6587dbca..e9dec8b78b 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -208,6 +208,17 @@ commit which modified the \"Version:\" pseudo header."
                       (current-buffer)
                       "git" "log" "-n1" "--oneline" "--no-patch"
                       "--pretty=format:%H"
+                      (when (elpaa--spec-get pkg-spec :merge)
+                        ;; Finding "the" revision when there's a merge
+                        ;; involved is fundamentally unreliable.
+                        ;; Ideally we should probably stop the search
+                        ;; at the first merge commit to avoid making
+                        ;; an arbitrary choice.
+                        ;; For `:merge'd packages, this is not an option, and
+                        ;; not using `--first-parent' will *usually* pick the
+                        ;; wrong revision (i.e. a revision from upstream
+                        ;; without our own changes).
+                        "--first-parent")
                       "-L" (concat "/^;;* *\\(Package-\\)\\?Version:/,+1:"
                                    (file-name-nondirectory mainfile))))
                     ;; The --no-patch (aka -s) option does not work
@@ -1006,7 +1017,7 @@ place the resulting tarball into the file named 
TARBALL-ONLY."
   "Like ‘call-process’ for PROGRAM, DESTINATION, ARGS.
 The INFILE and DISPLAY arguments are fixed as nil."
   (elpaa--message "call-process %s %S" program args)
-  (apply #'call-process program nil destination nil args))
+  (apply #'call-process program nil destination nil (delq nil args)))
 
 (defconst elpaa--bwrap-args
   '("--unshare-all"
@@ -2402,16 +2413,15 @@ relative to elpa root."
           (not (setq urtb (elpaa--merge pkg-spec urtb ortb))))
         (message "Merge failure for %S:\n%S" pkg
                  (buffer-string)))
-       ((zerop (apply #'elpaa--call
-                      t "git" "push" "--set-upstream"
-                      "origin"
-                      (format "%s:refs/heads/%s%s"
-                              urtb elpaa--branch-prefix pkg)
-                      (when release-branch
-                        (list
-                         (format "%s:refs/heads/%s%s"
-                                 (elpaa--urtb pkg-spec "release")
-                                 elpaa--release-branch-prefix pkg)))))
+       ((equal 0 (elpaa--call
+                  t "git" "push" "--set-upstream"
+                  "origin"
+                  (format "%s:refs/heads/%s%s"
+                          urtb elpaa--branch-prefix pkg)
+                  (when release-branch
+                    (format "%s:refs/heads/%s%s"
+                            (elpaa--urtb pkg-spec "release")
+                            elpaa--release-branch-prefix pkg))))
         (message "Pushed %s successfully:\n%s" pkg (buffer-string))
         (when (file-directory-p (expand-file-name pkg "packages"))
           (elpaa--worktree-sync pkg-spec)))



reply via email to

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