From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH 1/2] Add git version number to org-version information Date: Tue, 18 Aug 2009 13:22:42 -0400 Message-ID: <1250616163-11733-2-git-send-email-bernt@norang.ca> References: <1250616163-11733-1-git-send-email-bernt@norang.ca> Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MdSPE-0001DR-Du for emacs-orgmode@gnu.org; Tue, 18 Aug 2009 13:23:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MdSPA-0001BJ-5L for emacs-orgmode@gnu.org; Tue, 18 Aug 2009 13:23:31 -0400 Received: from [199.232.76.173] (port=59065 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdSPA-0001BG-2p for emacs-orgmode@gnu.org; Tue, 18 Aug 2009 13:23:28 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:49655) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MdSP9-0000G3-LP for emacs-orgmode@gnu.org; Tue, 18 Aug 2009 13:23:27 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1MdSP8-000KTb-TB for emacs-orgmode@gnu.org; Tue, 18 Aug 2009 17:23:26 +0000 In-Reply-To: <1250616163-11733-1-git-send-email-bernt@norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Bernt Hansen Adds the output of 'git describe' to the org-version string if we are running from a git repository. This identifies exactly what commit is checked out in the org-mode git repository when reporting the org-mode version number. org-version returns something like: Org-mode version 6.29trans (release_6.29c.42.g5996) which shows 6.29trans (somewhere after the last release tag) which is 42 commits after release_6.29c at git commit 5996. The git describe information is not included if org mode is not running from a git repository. --- lisp/org.el | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index b9f4229..3560a50 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -102,10 +102,22 @@ "Show the org-mode version in the echo area. With prefix arg HERE, insert it at point." (interactive "P") - (let ((version (format "Org-mode version %s" org-version))) - (message version) - (if here - (insert version)))) + (let* ((org-version org-version) + (dir (concat (file-name-directory (locate-library "org")) "../" ))) + (if (file-exists-p (expand-file-name ".git" dir)) + (progn + (shell-command (concat "cd " dir " && git describe --abbrev=4 HEAD")) + (save-excursion + (set-buffer "*Shell Command Output*") + (goto-char (point-min)) + (replace-regexp "-" ".") + (goto-char (point-min)) + (re-search-forward "[^\n]+") + (setq org-version (concat org-version " (" (match-string 0) ")"))))) + (let ((version (format "Org-mode version %s" org-version))) + (message version) + (if here + (insert version))))) ;;; Compatibility constants -- 1.6.4