X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=rc%2Fclearcase;h=14a3d881380bf4b2dfd6af42a6030eeb13582a19;hb=b4b5e8a7e6180ad1de85382f97e7496347057a51;hp=d2d8b0ca282e6ac11939e5006cc715ac2955ad83;hpb=020a4a5ea2be725b155cae3a2cadc9aba3911b9b;p=clearscm.git diff --git a/rc/clearcase b/rc/clearcase index d2d8b0c..14a3d88 100644 --- a/rc/clearcase +++ b/rc/clearcase @@ -11,28 +11,14 @@ # Modified: $Date: 2011/10/24 18:07:05 $ # Language: bash # -# (c) Copyright 2000-2011, ClearSCM, Inc., all rights reserved. +# (c) Copyright 2000-2016, ClearSCM, Inc., all rights reserved. # ################################################################################ -# Set ARCH, architecture of the machine -KERNEL=$(uname -s) - -if [[ $KERNEL = CYGWIN* ]]; then - export ARCH=cygwin - vobtagPrefix='\\\\\\\' -elif [ $KERNEL = "Linux" ]; then - export ARCH=linux -elif [ $KERNEL = "SunOS" ]; then - export ARCH=sun -elif [ $KERNEL = "FreeBSD" ]; then - export ARCH=$KERNEL -else - export ARCH='' - echo "Warning: Unknown architecture ($KERNEL)" -fi - -if [ $ARCH = 'cygwin' ]; then - export CCHOME=$(cygpath -u "$(regtool get '/machine/SOFTWARE/Rational Software/RSINSTALLDIR' 2>/dev/null)"/Clearcase 2>/dev/null); +if [ $ARCHITECTURE = 'cygwin' ]; then + # The following should work but fails because they are using /c to mount + # the C drive and that messes things up. + export CCHOME=$(cygpath -u "$(regtool get '/machine/SOFTWARE/Atria/ClearCase/CurrentVersion/ProductHome' 2>/dev/null)" 2>/dev/null) + export CCHOME=/opt/rational/clearcase else export CCHOME="/opt/rational/clearcase" fi @@ -53,7 +39,7 @@ export CLEARTOOL="$CCHOME/bin/cleartool" export CLEARCASE_BLD_HOST_TYPE="unix" if [ -f "$CCHOME/etc/utils/creds" ]; then - if [ $ARCH = 'cygwin' ]; then + if [ $ARCHITECTURE = 'cygwin' ]; then alias creds=$(cygpath "$CCHOME/etc/utils/creds") else alias creds="$CCHOME/etc/utils/creds" @@ -70,7 +56,7 @@ function scm { if [ -x "$CLEARTOOL" ]; then # Cleartool suddenly started appending ^M's (I think as of 7.1) - if [ $ARCH = 'cygwin' ]; then + if [ $ARCHITECTURE = 'cygwin' ]; then # Need to set pipefail to pick up the exit code from cleartool # otherwise we get the exit code from tr which is usually 0 set -o pipefail @@ -145,7 +131,7 @@ function lllock { # View related functions function setview { - if [ $ARCH = 'cygwin' ]; then + if [ $ARCHITECTURE = 'cygwin' ]; then if [[ $1 = -* ]]; then echo "The setview command with options is not supported on Windows" return @@ -374,7 +360,7 @@ function vtree { if [ $# != 1 ]; then echo "vtree: Error: Must specify an element to view its version tree" else - if [ $ARCH = 'cygwin' ]; then + if [ $ARCHITECTURE = 'cygwin' ]; then scm lsvtree -g "$@" else xlsvtree "$@" @@ -1667,7 +1653,7 @@ unlock \ unreserve \ " -if [ $ARCH = 'cygwin' ]; then +if [ $ARCHITECTURE = 'cygwin' ]; then _arch_policies="\ POLICY_WIN_INT_SNAP \ POLICY_WIN_DEV_SNAP \ @@ -1829,7 +1815,7 @@ function _vobs () { # We simply must rid ourselves of these bloody backlashes!!! And yet Clearcase # insists on retaining them. Let's strip them off, do our thing, then put them # back to backslashes when we output stuff. - if [ $ARCH = 'cygwin' ]; then + if [ $ARCHITECTURE = 'cygwin' ]; then if [ $# -eq 0 ]; then scm lsvob -short | sed 's:\\:\\\\\\\\:' else @@ -3656,7 +3642,7 @@ $_global_opts \ cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" - if [[ $cur == -* && $ARCH != cygwin ]]; then + if [[ $cur == -* && $ARCHITECTURE != cygwin ]]; then COMPREPLY=($(compgen -W "$opts" -- $cur)) elif [[ $cur == * ]]; then COMPREPLY=($(compgen -W "$(_views $cur)")) @@ -4094,36 +4080,48 @@ function _object_selector () { fi } # _object_selector -complete -o default -F _scm scm ct - -complete -F _catcs catcs -complete -F _checkin ci -complete -F _deliver deliver -complete -F _endview endview -complete -F _lsactivity lsact -complete -F _lsbl lsbl -complete -F _lsproject lsproj -complete -F _lsfolder lsfolder llfolder -complete -F _lsstgloc lsstgloc -complete -F _lsstream lsstream llstream -complete -F _lsview lsview llview -complete -F _lsvob lsvob llvob -complete -F _merge merge -complete -F _mktag mktag -complete -F _mkview mkview -complete -F _rebase rebase -complete -F _rmtag rmtag -complete -F _rmview rmview -complete -F _setactivity setact -complete -F _setcs setcs -complete -F _setview setview -complete -F _startview startview -complete -F _space space -complete -F _register register -complete -F _uncheckout unco -complete -F _unregister unregister - -complete -F _object_selector -o nospace lstype -complete -F _object_selector -o nospace lltype -complete -F _object_selector -o nospace lslock -complete -F _object_selector -o nospace lllock +if [[ $BASH_VERSION = 2.05* || $BASH_VERSION = 4* ]]; then + complete -o default -F _scm scm ct + + complete -F _catcs catcs + complete -F _checkin ci + complete -F _deliver deliver + complete -F _endview endview + complete -F _lsactivity lsact + complete -F _lsbl lsbl + complete -F _lsproject lsproj + complete -F _lsfolder lsfolder llfolder + complete -F _lsstgloc lsstgloc + complete -F _lsstream lsstream llstream + complete -F _lsview lsview llview + complete -F _lsvob lsvob llvob + complete -F _merge merge + complete -F _mktag mktag + complete -F _mkview mkview + complete -F _rebase rebase + complete -F _rmtag rmtag + complete -F _rmview rmview + complete -F _setactivity setact + complete -F _setcs setcs + complete -F _setview setview + complete -F _startview startview + complete -F _space space + complete -F _register register + complete -F _uncheckout unco + complete -F _unregister unregister +else + : echo 'Clearcase command completion broken on old Sun Bash shells' +fi + +if [[ $BASH_VERSION = 4* ]]; then + complete -F _object_selector -o nospace lstype + complete -F _object_selector -o nospace lltype + complete -F _object_selector -o nospace lslock + complete -F _object_selector -o nospace lllock +elif [[ $BASH_VERSION = 2.05* ]]; then + complete -F _object_selector lstype + complete -F _object_selector lltype + complete -F _object_selector lslock + complete -F _object_selector lllock + #echo 'Clearcase command completion partially broken on old Sun Bash shells' +fi