diff options
| -rw-r--r-- | doc/lispref/intro.texi | 12 | ||||
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/loadup.el | 4 | ||||
| -rw-r--r-- | lisp/mail/emacsbug.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-cmds.el | 5 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 11 | ||||
| -rw-r--r-- | lisp/net/trampver.el | 28 | ||||
| -rw-r--r-- | lisp/version.el | 28 |
8 files changed, 75 insertions, 19 deletions
diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi index 197f54ecc52..2353cf956cc 100644 --- a/doc/lispref/intro.texi +++ b/doc/lispref/intro.texi | |||
| @@ -530,6 +530,18 @@ directory (without cleaning). This is only of relevance when | |||
| 530 | developing Emacs. | 530 | developing Emacs. |
| 531 | @end defvar | 531 | @end defvar |
| 532 | 532 | ||
| 533 | @defvar emacs-repository-version | ||
| 534 | A string that gives the repository revision from which Emacs was | ||
| 535 | built. If Emacs was built outside revision control, the value is | ||
| 536 | @code{nil}. | ||
| 537 | @end defvar | ||
| 538 | |||
| 539 | @defvar emacs-repository-branch | ||
| 540 | A string that gives the repository branch from which Emacs was built. | ||
| 541 | In the most cases this is @code{"master"}. If Emacs was built outside | ||
| 542 | revision control, the value is @code{nil}. | ||
| 543 | @end defvar | ||
| 544 | |||
| 533 | @node Acknowledgments | 545 | @node Acknowledgments |
| 534 | @section Acknowledgments | 546 | @section Acknowledgments |
| 535 | 547 | ||
| @@ -225,6 +225,10 @@ In addition to nil or non-nil, the value can now be a predicate | |||
| 225 | function. Follow mode uses this to control scrolling of its windows | 225 | function. Follow mode uses this to control scrolling of its windows |
| 226 | when the last screen line in a window is not fully visible. | 226 | when the last screen line in a window is not fully visible. |
| 227 | 227 | ||
| 228 | +++ | ||
| 229 | ** New variable 'emacs-repository-branch'. | ||
| 230 | It reports the git branch from which Emacs was built. | ||
| 231 | |||
| 228 | 232 | ||
| 229 | * Editing Changes in Emacs 27.1 | 233 | * Editing Changes in Emacs 27.1 |
| 230 | 234 | ||
diff --git a/lisp/loadup.el b/lisp/loadup.el index 5ecfae170fc..eb663538a3b 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -368,8 +368,8 @@ lost after dumping"))) | |||
| 368 | (string-to-number | 368 | (string-to-number |
| 369 | (substring name (length base) exelen)))) | 369 | (substring name (length base) exelen)))) |
| 370 | files))) | 370 | files))) |
| 371 | (setq emacs-repository-version (condition-case nil (emacs-repository-get-version) | 371 | (setq emacs-repository-version (ignore-errors (emacs-repository-get-version)) |
| 372 | (error nil))) | 372 | emacs-repository-branch (ignore-errors (emacs-repository-get-branch))) |
| 373 | ;; A constant, so we shouldn't change it with `setq'. | 373 | ;; A constant, so we shouldn't change it with `setq'. |
| 374 | (defconst emacs-build-number | 374 | (defconst emacs-build-number |
| 375 | (if versions (1+ (apply 'max versions)) 1)))) | 375 | (if versions (1+ (apply 'max versions)) 1)))) |
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 8cacad8726d..e55f950aac3 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el | |||
| @@ -307,6 +307,8 @@ usually do not have translators for other languages.\n\n"))) | |||
| 307 | 307 | ||
| 308 | (if (stringp emacs-repository-version) | 308 | (if (stringp emacs-repository-version) |
| 309 | (insert "Repository revision: " emacs-repository-version "\n")) | 309 | (insert "Repository revision: " emacs-repository-version "\n")) |
| 310 | (if (stringp emacs-repository-branch) | ||
| 311 | (insert "Repository branch: " emacs-repository-branch "\n")) | ||
| 310 | (if (fboundp 'x-server-vendor) | 312 | (if (fboundp 'x-server-vendor) |
| 311 | (condition-case nil | 313 | (condition-case nil |
| 312 | ;; This is used not only for X11 but also W32 and others. | 314 | ;; This is used not only for X11 but also W32 and others. |
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 456300e7662..3c8f182ae97 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el | |||
| @@ -198,8 +198,9 @@ This includes password cache, file cache, connection cache, buffers." | |||
| 198 | ;; In rare cases, it could contain the password. So we make it nil. | 198 | ;; In rare cases, it could contain the password. So we make it nil. |
| 199 | tramp-password-save-function) | 199 | tramp-password-save-function) |
| 200 | (reporter-submit-bug-report | 200 | (reporter-submit-bug-report |
| 201 | tramp-bug-report-address ; to-address | 201 | tramp-bug-report-address ; to-address |
| 202 | (format "tramp (%s)" tramp-version) ; package name and version | 202 | (format "tramp (%s %s/%s)" ; package name and version |
| 203 | tramp-version tramp-repository-branch tramp-repository-version) | ||
| 203 | (sort | 204 | (sort |
| 204 | (delq nil (mapcar | 205 | (delq nil (mapcar |
| 205 | (lambda (x) | 206 | (lambda (x) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 44d66404f15..e8d535e85ed 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1609,10 +1609,13 @@ ARGUMENTS to actually emit the message (if applicable)." | |||
| 1609 | ";; Emacs: %s Tramp: %s -*- mode: outline; -*-" | 1609 | ";; Emacs: %s Tramp: %s -*- mode: outline; -*-" |
| 1610 | emacs-version tramp-version)) | 1610 | emacs-version tramp-version)) |
| 1611 | (when (>= tramp-verbose 10) | 1611 | (when (>= tramp-verbose 10) |
| 1612 | (insert | 1612 | (let ((tramp-verbose 0)) |
| 1613 | (format | 1613 | (insert |
| 1614 | "\n;; Location: %s Git: %s" | 1614 | (format |
| 1615 | (locate-library "tramp") (tramp-repository-get-version))))) | 1615 | "\n;; Location: %s Git: %s/%s" |
| 1616 | (locate-library "tramp") | ||
| 1617 | (or tramp-repository-branch "") | ||
| 1618 | (or tramp-repository-version "")))))) | ||
| 1616 | (unless (bolp) | 1619 | (unless (bolp) |
| 1617 | (insert "\n")) | 1620 | (insert "\n")) |
| 1618 | ;; Timestamp. | 1621 | ;; Timestamp. |
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index de76788cc0e..f93e5380849 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el | |||
| @@ -38,17 +38,23 @@ | |||
| 38 | (defconst tramp-bug-report-address "tramp-devel@gnu.org" | 38 | (defconst tramp-bug-report-address "tramp-devel@gnu.org" |
| 39 | "Email address to send bug reports to.") | 39 | "Email address to send bug reports to.") |
| 40 | 40 | ||
| 41 | (defun tramp-repository-get-version () | 41 | (defconst tramp-repository-branch |
| 42 | "Try to return as a string the repository revision of the Tramp sources." | 42 | (ignore-errors |
| 43 | (let ((dir (locate-dominating-file (locate-library "tramp") ".git"))) | 43 | ;; Suppress message from `emacs-repository-get-branch'. |
| 44 | (when dir | 44 | (let ((inhibit-message t)) |
| 45 | (with-temp-buffer | 45 | ;; `emacs-repository-get-branch' has been introduced with Emacs 27.1. |
| 46 | (let ((default-directory (file-name-as-directory dir))) | 46 | (with-no-warnings |
| 47 | (and (zerop | 47 | (emacs-repository-get-branch |
| 48 | (ignore-errors | 48 | (locate-dominating-file (locate-library "tramp") ".git"))))) |
| 49 | (call-process "git" nil '(t nil) nil "rev-parse" "HEAD"))) | 49 | "The repository branch of the Tramp sources.") |
| 50 | (not (zerop (buffer-size))) | 50 | |
| 51 | (replace-regexp-in-string "\n" "" (buffer-string)))))))) | 51 | (defconst tramp-repository-version |
| 52 | (ignore-errors | ||
| 53 | ;; Suppress message from `emacs-repository-get-version'. | ||
| 54 | (let ((inhibit-message t)) | ||
| 55 | (emacs-repository-get-version | ||
| 56 | (locate-dominating-file (locate-library "tramp") ".git")))) | ||
| 57 | "The repository revision of the Tramp sources.") | ||
| 52 | 58 | ||
| 53 | ;; Check for Emacs version. | 59 | ;; Check for Emacs version. |
| 54 | (let ((x (if (not (string-lessp emacs-version "24.1")) | 60 | (let ((x (if (not (string-lessp emacs-version "24.1")) |
diff --git a/lisp/version.el b/lisp/version.el index 84919308191..c72164cdacc 100644 --- a/lisp/version.el +++ b/lisp/version.el | |||
| @@ -135,6 +135,34 @@ Optional argument DIR is a directory to use instead of `source-directory'. | |||
| 135 | Optional argument EXTERNAL is ignored." | 135 | Optional argument EXTERNAL is ignored." |
| 136 | (emacs-repository-version-git (or dir source-directory))) | 136 | (emacs-repository-version-git (or dir source-directory))) |
| 137 | 137 | ||
| 138 | (defvar emacs-repository-branch nil | ||
| 139 | "String giving the repository branch from which this Emacs was built. | ||
| 140 | Value is nil if Emacs was not built from a repository checkout, | ||
| 141 | or if we could not determine the branch.") | ||
| 142 | |||
| 143 | (defun emacs-repository-branch-git (dir) | ||
| 144 | "Ask git itself for the branch information for directory DIR." | ||
| 145 | (message "Waiting for git...") | ||
| 146 | (with-temp-buffer | ||
| 147 | (let ((default-directory (file-name-as-directory dir))) | ||
| 148 | (and (zerop | ||
| 149 | (with-demoted-errors "Error running git rev-parse --abbrev-ref: %S" | ||
| 150 | (call-process "git" nil '(t nil) nil | ||
| 151 | "rev-parse" "--abbrev-ref" "HEAD"))) | ||
| 152 | (goto-char (point-min)) | ||
| 153 | (buffer-substring (point) (line-end-position)))))) | ||
| 154 | |||
| 155 | (defun emacs-repository-get-branch (&optional dir) | ||
| 156 | "Try to return as a string the repository branch of the Emacs sources. | ||
| 157 | The format of the returned string is dependent on the VCS in use. | ||
| 158 | Value is nil if the sources do not seem to be under version | ||
| 159 | control, or if we could not determine the branch. Note that | ||
| 160 | this reports on the current state of the sources, which may not | ||
| 161 | correspond to the running Emacs. | ||
| 162 | |||
| 163 | Optional argument DIR is a directory to use instead of `source-directory'." | ||
| 164 | (emacs-repository-branch-git (or dir source-directory))) | ||
| 165 | |||
| 138 | ;; We put version info into the executable in the form that `ident' uses. | 166 | ;; We put version info into the executable in the form that `ident' uses. |
| 139 | (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version)) | 167 | (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version)) |
| 140 | " $\n")) | 168 | " $\n")) |