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

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

[nongnu] elpa/git-commit 429d5c55e8: magit-tag-release: Use version from


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 429d5c55e8: magit-tag-release: Use version from HEAD's message if appropriate
Date: Sun, 30 Jan 2022 14:58:44 -0500 (EST)

branch: elpa/git-commit
commit 429d5c55e82dd4480094d55fd0add9a872f43691
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    magit-tag-release: Use version from HEAD's message if appropriate
---
 lisp/magit-tag.el | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/lisp/magit-tag.el b/lisp/magit-tag.el
index c10a46c8d6..cf53c0acac 100644
--- a/lisp/magit-tag.el
+++ b/lisp/magit-tag.el
@@ -140,15 +140,21 @@ If this matches versions that are not dot separated 
numbers,
 then `magit-tag-version-regexp-alist' has to contain entries
 for the separators allowed here.")
 
+(defvar magit-release-commit-regexp "\\`Release version \\(.+\\)\\'"
+  "Regexp used by `magit-tag-release' to parse release commit messages.
+The first submatch must match the version string.")
+
 ;;;###autoload
 (defun magit-tag-release (tag msg &optional args)
-  "Create a release tag.
+  "Create a release tag for `HEAD'.
 
 Assume that release tags match `magit-release-tag-regexp'.
 
-First prompt for the name of the new tag using the highest
-existing tag as initial input and leaving it to the user to
-increment the desired part of the version string.
+If `HEAD's message matches `magit-release-commit-regexp', then
+base the tag on the version string specified by that.  Otherwise
+prompt for the name of the new tag using the highest existing
+tag as initial input and leaving it to the user to increment the
+desired part of the version string.
 
 If `--annotate' is enabled, then prompt for the message of the
 new tag.  Base the proposed tag message on the message of the
@@ -161,7 +167,16 @@ like \"/path/to/foo-bar\"."
    (save-match-data
      (pcase-let*
          ((`(,pver ,ptag ,pmsg) (car (magit--list-releases)))
-          (tag (read-string "Create release tag: " ptag))
+          (msg (magit-rev-format "%s"))
+          (ver (and (string-match magit-release-commit-regexp msg)
+                    (match-string 1 msg)))
+          (tag (if ver
+                   (concat (and (string-match magit-release-tag-regexp ptag)
+                                (match-string 1 ptag))
+                           ver)
+                 (read-string
+                  (format "Create release tag (previous was %s): " ptag)
+                  ptag)))
           (ver (and (string-match magit-release-tag-regexp tag)
                     (match-string 2 tag)))
           (args (magit-tag-arguments)))



reply via email to

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