diff options
| author | Stefan Kangas | 2021-12-27 02:44:27 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2021-12-27 20:39:10 +0100 |
| commit | 0fb55c8776d75d08da626f84ca5570da7e95391e (patch) | |
| tree | e9726b54f9854813ed8810bc47b4bbb2970861a7 /admin | |
| parent | 85cb4f419b2e7c3b53b42d50d4c0c588931d02c6 (diff) | |
| download | emacs-0fb55c8776d75d08da626f84ca5570da7e95391e.tar.gz emacs-0fb55c8776d75d08da626f84ca5570da7e95391e.zip | |
admin.el: Move etc/NEWS to etc/NEWS.NN in one commit
This should preserve git history better for git blame, etc.
* admin/admin.el (admin-git-command): New variable.
(set-version): Move etc/NEWS to etc/NEWS.NN and prompt to commit
it immediately. (Bug#52420)
Diffstat (limited to 'admin')
| -rw-r--r-- | admin/admin.el | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/admin/admin.el b/admin/admin.el index ad4208beef0..c1bdb13df96 100644 --- a/admin/admin.el +++ b/admin/admin.el | |||
| @@ -88,6 +88,9 @@ Optional argument DATE is the release date, default today." | |||
| 88 | (kill-buffer) | 88 | (kill-buffer) |
| 89 | (message "No need to update `%s'" file))) | 89 | (message "No need to update `%s'" file))) |
| 90 | 90 | ||
| 91 | (defvar admin-git-command (executable-find "git") | ||
| 92 | "The `git' program to use.") | ||
| 93 | |||
| 91 | (defun set-version (root version) | 94 | (defun set-version (root version) |
| 92 | "Set Emacs version to VERSION in relevant files under ROOT. | 95 | "Set Emacs version to VERSION in relevant files under ROOT. |
| 93 | Root must be the root of an Emacs source tree." | 96 | Root must be the root of an Emacs source tree." |
| @@ -96,6 +99,8 @@ Root must be the root of an Emacs source tree." | |||
| 96 | (read-string "Version number: " emacs-version))) | 99 | (read-string "Version number: " emacs-version))) |
| 97 | (unless (file-exists-p (expand-file-name "src/emacs.c" root)) | 100 | (unless (file-exists-p (expand-file-name "src/emacs.c" root)) |
| 98 | (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) | 101 | (user-error "%s doesn't seem to be the root of an Emacs source tree" root)) |
| 102 | (unless admin-git-command | ||
| 103 | (user-error "Could not find git; please install git and move NEWS manually")) | ||
| 99 | (message "Setting version numbers...") | 104 | (message "Setting version numbers...") |
| 100 | ;; There's also a "version 3" (standing for GPLv3) at the end of | 105 | ;; There's also a "version 3" (standing for GPLv3) at the end of |
| 101 | ;; `README', but since `set-version-in-file' only replaces the first | 106 | ;; `README', but since `set-version-in-file' only replaces the first |
| @@ -157,7 +162,13 @@ Root must be the root of an Emacs source tree." | |||
| 157 | Documentation changes might not have been completed!")))) | 162 | Documentation changes might not have been completed!")))) |
| 158 | (when (and majorbump | 163 | (when (and majorbump |
| 159 | (not (file-exists-p oldnewsfile))) | 164 | (not (file-exists-p oldnewsfile))) |
| 160 | (rename-file newsfile oldnewsfile) | 165 | (call-process admin-git-command nil nil nil |
| 166 | "mv" newsfile oldnewsfile) | ||
| 167 | (when (y-or-n-p "Commit move of NEWS file?") | ||
| 168 | (call-process admin-git-command nil nil nil | ||
| 169 | "commit" "-m" (format "; Move etc/%s to etc/%s" | ||
| 170 | (file-name-nondirectory newsfile) | ||
| 171 | (file-name-nondirectory oldnewsfile)))) | ||
| 161 | (find-file oldnewsfile) ; to prompt you to commit it | 172 | (find-file oldnewsfile) ; to prompt you to commit it |
| 162 | (copy-file oldnewsfile newsfile) | 173 | (copy-file oldnewsfile newsfile) |
| 163 | (with-temp-buffer | 174 | (with-temp-buffer |