CDDL HEADER START
The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions
and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at usr/src/OPENSOLARIS.LICENSE.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]
CDDL HEADER END
Copyright 2008 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
which_scm 1ONBLD "18 September 2009"
NAME
which_scm - Report Source Code Management system
SYNOPSIS
which_scm
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 1If 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 teamwareIf 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.
ENVIRONMENT VARIABLES
The following environment variable is used by which_scm:
CODEMGR_WS path to current workspace.
SEE ALSO
cvs(1) , git(1) , hg(1) , sccs(1) svn(1) , workspace(1)