Add a rev number to SPC hds.

Describe system information was useless if we don't know which rev.
people are using. This adds this information.
This commit is contained in:
Robert O'Connor 2015-08-20 00:26:26 -04:00 committed by syl20bnr
parent a8582813c0
commit 7da1b876aa
2 changed files with 22 additions and 4 deletions

View File

@ -208,11 +208,28 @@ version and the NEW version."
(kill-buffer proc-buffer)))) (kill-buffer proc-buffer))))
(defun spacemacs/git-get-current-branch () (defun spacemacs/git-get-current-branch ()
"Return the current branch. Return nil if an error occurred." "Return the current branch. Return nil if an error occurred."
(let((proc-buffer "git-get-current-branch") (let((proc-buffer "git-get-current-branch")
(default-directory (file-truename user-emacs-directory)))
(when (eq 0 (process-file "git" nil proc-buffer nil
"symbolic-ref" "--short" "-q" "HEAD"))
(with-current-buffer proc-buffer
(prog1
(when (buffer-string)
(goto-char (point-min))
(replace-regexp-in-string
"\n$" ""
(buffer-substring (line-beginning-position)
(line-end-position))))
(kill-buffer proc-buffer))))))
(defun spacemacs/git-get-current-branch-rev ()
"Returns the hash of the head commit on the current branch.
Returns nil if an error occurred."
(let((proc-buffer "git-get-current-branch-head-hash")
(default-directory (file-truename user-emacs-directory))) (default-directory (file-truename user-emacs-directory)))
(when (eq 0 (process-file "git" nil proc-buffer nil (when (eq 0 (process-file "git" nil proc-buffer nil
"symbolic-ref" "--short" "-q" "HEAD")) "rev-parse" "--short" "HEAD"))
(with-current-buffer proc-buffer (with-current-buffer proc-buffer
(prog1 (prog1
(when (buffer-string) (when (buffer-string)

View File

@ -249,12 +249,13 @@ FILE-TO-LOAD is an explicit file to load after the installation."
"- OS: %s\n" "- OS: %s\n"
"- Emacs: %s\n" "- Emacs: %s\n"
"- Spacemacs: %s\n" "- Spacemacs: %s\n"
"- Spacemacs branch: %s\n" "- Spacemacs branch: %s (rev. %s)\n"
"- Layers:\n```elisp\n%s```\n") "- Layers:\n```elisp\n%s```\n")
system-type system-type
emacs-version emacs-version
spacemacs-version spacemacs-version
(spacemacs/git-get-current-branch) (spacemacs/git-get-current-branch)
(spacemacs/git-get-current-branch-rev)
(pp dotspacemacs-configuration-layers)))) (pp dotspacemacs-configuration-layers))))
(kill-new sysinfo) (kill-new sysinfo)
(message sysinfo) (message sysinfo)