2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright held by original author
8 #------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM; if not, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 # Report on OpenFOAM version, and source code revision number.
31 # This implementation is using the Subversion revision control system
32 # for retrieving the revision number.
35 # Martin Beaudoin, Hydro-Quebec, (2009)
37 #------------------------------------------------------------------------------
41 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
44 Usage: $Script [-revision] [-help]
46 Report on the version of OpenFOAM, and if available, the source code revision number.
48 If the source code revision number is not directly available, then the string
49 "exported" will be reported for the revision number.
52 -revision : Report only the revision number
60 # Initialize the SVN client command
63 # initialize the Revision number to "exported" by default.
64 # This is the expected information reported by svnversion when the source code is not from a
66 FOAM_DEV_SVN_REVISION_NUMBER
="exported"
68 if [ -e $WM_PROJECT_DIR/.svn
]
70 # Check if a svn client in available
71 status
=`$SVN_CMD --version --quiet >& /dev/null`
75 # We are not using svnversion here because it is recursive, and this can take a while.
77 # We are forcing LC_ALL=C in order to get rid of any locale variations in the ouput of
78 # the command $SVN_CMD
80 # We are grabbing the revision number associated to "Last Changed Rev:" for the svn repository
81 # branch associated with $WM_PROJECT_DIR. That way, we will not pickup changes in revision number
82 # coming from other parts of the Subversion repository.
84 FOAM_DEV_SVN_REVISION_NUMBER
=`LC_ALL=C $SVN_CMD info $WM_PROJECT_DIR | grep "Last Changed Rev:" | awk '{print $4}'`;
91 # Only output the svn version number. Handy when called from Makefiles or scripts
92 echo $FOAM_DEV_SVN_REVISION_NUMBER
100 if [ $FOAM_DEV_SVN_REVISION_NUMBER ]
102 echo "OpenFOAM version $WM_PROJECT_VERSION, revision $FOAM_DEV_SVN_REVISION_NUMBER"
104 echo "OpenFOAM version $WM_PROJECT_VERSION"
112 #------------------------------------------------------------------------------