2 #------------------------------------------------------------------------------
4 # \\ / F ield | foam-extend: Open Source CFD
6 # \\ / A nd | For copyright notice see file Copyright
8 #------------------------------------------------------------------------------
10 # This file is part of foam-extend.
12 # foam-extend 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 3 of the License, or (at your
15 # option) any later version.
17 # foam-extend is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
29 # Report on OpenFOAM version, and source code revision number.
30 # This implementation is using the Subversion revision control system
31 # for retrieving the revision number.
34 # Martin Beaudoin, Hydro-Quebec, (2009)
36 #------------------------------------------------------------------------------
40 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
43 Usage: $Script [-revision] [-help]
45 Report on the version of OpenFOAM, and if available, the source code revision number.
47 If the source code revision number is not directly available, then the string
48 "exported" will be reported for the revision number.
51 -revision : Report only the revision number
59 # Initialize the SVN client command
62 # initialize the Revision number to "exported" by default.
63 # This is the expected information reported by svnversion when the source code is not from a
65 FOAM_DEV_SVN_REVISION_NUMBER
="exported"
67 if [ -e $WM_PROJECT_DIR/.svn
]
69 # Check if a svn client in available
70 status
=`$SVN_CMD --version --quiet >& /dev/null`
74 # We are not using svnversion here because it is recursive, and this can take a while.
76 # We are forcing LC_ALL=C in order to get rid of any locale variations in the ouput of
77 # the command $SVN_CMD
79 # We are grabbing the revision number associated to "Last Changed Rev:" for the svn repository
80 # branch associated with $WM_PROJECT_DIR. That way, we will not pickup changes in revision number
81 # coming from other parts of the Subversion repository.
83 FOAM_DEV_SVN_REVISION_NUMBER
=`LC_ALL=C $SVN_CMD info $WM_PROJECT_DIR | grep "Last Changed Rev:" | awk '{print $4}'`;
90 # Only output the svn version number. Handy when called from Makefiles or scripts
91 echo $FOAM_DEV_SVN_REVISION_NUMBER
99 if [ $FOAM_DEV_SVN_REVISION_NUMBER ]
101 echo "OpenFOAM version $WM_PROJECT_VERSION, revision $FOAM_DEV_SVN_REVISION_NUMBER"
103 echo "OpenFOAM version $WM_PROJECT_VERSION"
111 #------------------------------------------------------------------------------