From f34017d0239526086e753b4499147487457b2049 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Sat, 3 May 2014 15:21:32 +0200 Subject: [PATCH] Improve version strings. Have the abbreviated git hash appear in the version string when not using a released version of pgloader. --- README.md | 19 +++++++++++++++++++ src/params.lisp | 19 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dd1efe9..e5c0ef0 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,25 @@ The versioning is now following the Emacs model, where any X.0 release number means you're using a development version (alpha, beta, or release candidate). The next stable versions are going to be `3.1` then `3.2` etc. +When using a development snapshot rather than a released version the version +number includes the git hash (in its abbreviated form): + + - `pgloader version "3.0.99"` + + Release candidate 9 for pgloader version 3.1, with a *git tag* named + `v3.0.99` so that it's easy to checkout the same sources as the + released code. + + - `pgloader version "3.0.fecae2c"` + + Development snapshot again *git hash* `fecae2c`. It's possible to have + the same sources on another setup with using the git command `git + checkout fecae2c`. + + - `pgloader version "3.1.0"` + + Stable release. + ## INSTALL pgloader is now a Common Lisp program, tested using the diff --git a/src/params.lisp b/src/params.lisp index d3798c8..0c4726e 100644 --- a/src/params.lisp +++ b/src/params.lisp @@ -32,7 +32,24 @@ (in-package :pgloader.params) -(defparameter *version-string* "3.0.99" +(defparameter *release* nil + "non-nil when this build is a release build.") + +(defparameter *major-version* "3.0") +(defparameter *minor-version* "99") + +(defun git-hash () + "Return the current abbreviated git hash of the development tree." + (let ((git-hash `("git" "--no-pager" "log" "-n1" "--format=format:%h"))) + (uiop:with-current-directory ((asdf:system-source-directory :pgloader)) + (multiple-value-bind (stdout stderr code) + (uiop:run-program git-hash :output :string) + (declare (ignore code stderr)) + stdout)))) + +(defparameter *version-string* + (concatenate 'string *major-version* "." + (if *release* *minor-version* (git-hash))) "pgloader version strings, following Emacs versionning model.") ;; we can't use pgloader.utils:make-pgstate yet because params is compiled