diff options
author | Glenn Morris <rgm@gnu.org> | 2012-04-07 12:51:51 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2012-04-07 12:51:51 -0700 |
commit | a1ed8b05eedc1bded036d1c35a867fbdc7a1eba2 (patch) | |
tree | ea491cfee820029fafd1162d50abc7a834674aed /lisp | |
parent | e3fb2efb80ee8beebf7963228c4508496ebf24fa (diff) | |
download | emacs-a1ed8b05eedc1bded036d1c35a867fbdc7a1eba2.tar.gz |
Add emacs-bzr-version
* lisp/version.el (emacs-bzr-get-version): New function.
* lisp/loadup.el (emacs-bzr-version): Set it.
* lisp/mail/emacsbug.el (report-emacs-bug): Include bzr version.
* etc/NEWS: Mention this, though it is not really relevant to releases.
Insert template for 24.2 release.
Fixes: debbugs:8054
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ChangeLog | 6 | ||||
-rw-r--r-- | lisp/loadup.el | 2 | ||||
-rw-r--r-- | lisp/mail/emacsbug.el | 2 | ||||
-rw-r--r-- | lisp/version.el | 20 |
4 files changed, 30 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 027b6631639..179b7ff3a31 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-04-07 Glenn Morris <rgm@gnu.org> + + * version.el (emacs-bzr-get-version): New function. + * loadup.el (emacs-bzr-version): Set it. (Bug#8054) + * mail/emacsbug.el (report-emacs-bug): Include bzr version. + 2012-04-07 Eli Zaretskii <eliz@gnu.org> * international/uni-bidi.el: diff --git a/lisp/loadup.el b/lisp/loadup.el index b7af41d6246..16cd0171e61 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -259,6 +259,8 @@ (versions (mapcar (function (lambda (name) (string-to-number (substring name (length base))))) files))) + (setq emacs-bzr-version (condition-case nil (emacs-bzr-get-version) + (error nil))) ;; `emacs-version' is a constant, so we shouldn't change it with `setq'. (defconst emacs-version (format "%s.%d" diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el index 1a02ae7c519..33b73335a7d 100644 --- a/lisp/mail/emacsbug.el +++ b/lisp/mail/emacsbug.el @@ -239,6 +239,8 @@ usually do not have translators for other languages.\n\n"))) (add-text-properties (1+ user-point) (point) prompt-properties) (insert "\n\nIn " (emacs-version) "\n") + (if (stringp emacs-bzr-version) + (insert "Bzr revision: " emacs-bzr-version "\n")) (if (fboundp 'x-server-vendor) (condition-case nil ;; This is used not only for X11 but also W32 and others. diff --git a/lisp/version.el b/lisp/version.el index bd30f0f81b8..a4bc4fd54a6 100644 --- a/lisp/version.el +++ b/lisp/version.el @@ -79,6 +79,26 @@ to the system configuration; look at `system-configuration' instead." ;; We hope that this alias is easier for people to find. (defalias 'version 'emacs-version) +;; Set during dumping, this is a defvar so that it can be setq'd. +(defvar emacs-bzr-version nil "\ +String giving the bzr revision number from which this Emacs was built. +This is nil if Emacs was not built from a bzr checkout, or if we could +not determine the revision.") + +(defun emacs-bzr-get-version () "\ +Try to return as a string the bzr revision number of the Emacs sources. +Returns nil if the sources do not seem to be under bzr, or if we could +not determine the revision. Note that this reports on the current state +of the sources, which may not correspond to the running Emacs." + (let ((file (expand-file-name ".bzr/branch/last-revision" source-directory))) + (if (file-readable-p file) + (with-temp-buffer + (insert-file-contents file) + (goto-char (point-max)) + (if (looking-back "\n") + (delete-char -1)) + (buffer-string))))) + ;; We put version info into the executable in the form that `ident' uses. (or (eq system-type 'windows-nt) (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version)) |