DESCRIPTION
which_scm detects the Source Code Management (SCM) system in use, and prints a single line of text containing a one-word name for the SCM, followed by a space, and then the top-level directory path for the workspace.
The typical usage within a ksh script is:
which_scm | read SCM_TYPE CODEMGR_WS || exit 1
If CODEMGR_WS is set in the environment, then
which_scm checks only that directory, assuming that it is the top of the tree.
If CODEMGR_WS is not set, then
which_scm searches upwards to find the containing workspace path, and reports that path.
which_scm can detect the following types of SCM systems (these are the keywords used in the output format):
cvs
git
mercurial
rcs
sccs
subversion
teamware
If the type of SCM in use is not known, then the string "unknown" is printed, and the path returned is $CODEMGR_WS (if set) or the current working directory. The command may exit with an error if the SCM could be detected, but is unusable.