7.11. Starteam CLI Wrapper

stcmd 是 starteam 的命令行工具,基于 java。因此运行 stcmd,首先需要建立 java 环境。对于 OpenBSD 系统,要Enable FreeBSD Compatible,再安装 Jave 虚拟机。

Starteam 的功能远远弱于其图形界面,而且命令行参数复杂,难于使用。我们 用 SHELL 包装了一层:“st”,采用类似 CVS 的命令行。

理解 .starteam.ini

# .starteam.ini 通过命令 st config 生成
# StarTeam Configuration: /usr/project/branch2/release/.starteam.ini
STUSER="releng"
STPASSWDFILE="/project/.relfw.passwd"
STSERVER="10.1.1.60"
STPORT="49201"
STWORKROOT="/usr/project/branch2/release"
STPROJECT="project"
STVIEW="branch_2_0"
STFOLDER=""
STCFGD=""
STCFGL=""
STCFGP="release"

st 的参数及使用方法

StarTeam command line emulator, $Revision$, by YZW,JX

Usage: st [st_options] [st_command] [command_options] [command_args]
    st      
            The name of the starteam wrapper
    st_options
            Some options that affect all sub-command of st.
    st_command
            One of several different sub-commands.
    command_options
            Options that are specific for the command.
    command_args
            Arguments to the commands.
    
    Global options
    =============================================
    -h      help
    -V      show version
    -r      readonly
    -w      readwrite
    -v      verbose, show version info. (--nv : no verbose)
    -z      compress during tranfer. (--nz : not compress)
    -q      a bit quiet mode. only show difference.
    -qq     more  quiet mode. more quiet then -q. 
            (not show status "Not In View" and folder info)
    -Q      most  quiet mode. output nothing. 
            (--nq: not quiet is default)
    --eol    set eol(symbol of end-of-line) to platform specific. 
            CR on unix, CR/LF on windows. (--neol : leave eol aside)
    -I      Interactive mode. (    --nI / --batch : Batch mode.)
    -S / -s    
            Stop on error./ No Stop.
    --exitcode
            On Error return 1, success return 0. 
            Conflict with -q and -qq
    
    Command Options
    =============================================
    -f      Force. Force starteam to ci/co a new revision even if you 
            haven't made any changes to the file. _'
    -l      Local; run only in current working directory, rather than 
            recursing through subdirectories.
    -R      Process directories recursively.
    -m message
            Use message as log information, instead of invoking an editor.
    -D date spec
            Use the most recent revision no later than date spec. 
            date spec is a single argument, a date description specifying 
            a date in the past.
    --lock / --unlock
            Lock files./Unlock files.
    -r tag
            Use the revision specified by the tag argument instead of the
            default head revision.
    
    Commands
    =============================================
    
    help
    ----------------------------------------
    Syntax:    st help
        Show this screen.

    config
    ----------------------------------------
    Syntax:    st config
        Maybe the first command you run. Configure INI file.

        Truth behind "st config". Only for smart boys/girls:
            After running this configuration, a config file, .starteam.ini
            will be created under current directory.
            There several KeyValue pairs.

                STUSER  :       login name for starteam user
                STSERVER:       ip address of starteam server
                STPORT  :       tcp port of starteam server
                STPROJECT:      project name you want to check in/out
                STVIEW  :       view    name you want to check in/out
                STFOLDER:       folder name of the view you want to check
                STCFGD  :       check out base on Date.
                                Date format:
                                        "12/29/97 10:52 AM"
                                        "29-Dec-97 10:52:00 AM"
                                        "December 29, 1997 10:52:00 AM PST"
                                        "Monday, December 29, 1997 10:52:00 
                                                oclock AM PST"
                STCFGL  :       check out base on Label
                STCFGP  :       check out base on Promotion State
                STWORKROOT:     the root of your working dir
                


    default
    ----------------------------------------
    Syntax:    st default
        Show default params

    add
    ----------------------------------------
    Syntax:    st [global_opts] add [--lock|--unlock|--nelock] [-m "message"] 
                [--vl "label"] [files...]
        Add files to version control

    import    (add-folder)
    ----------------------------------------
    Syntax:    st [global_opts] import [--ex "excludeType"][--exlist "fileMask" |
                 --exfile "fileName"] [foldername...]
        Add directory.

    ci    (commit / checkin)
    ----------------------------------------
    Syntax:    st [global_opts] ci [--filter ...] [--lock|--unlock] [-m "comment"]
                [--force] [--necessary] <files...>
        Check in files from local to server.

    co    (checkout / update / up)
    ----------------------------------------
    Syntax:    st [global_opts] co [--lock|--unlock] [-r revision] [--nessary] 
                [--touch][--merge [--dryrun|--alwaysprompt|--neverprompt|
                --conflictprompt] <files...>
        Check out files from server to local.

    checkdir (cd)
    ----------------------------------------
    Syntax:    st [global_opts] cd <directory...>
        Check out the Directory structure, but no files.

    diff
    ----------------------------------------
    Syntax:    st [global_opts] diff [-r revision] [--filter ...] <files...>
        differ.

    list
    ----------------------------------------
    Syntax:    st list <files...>
        List files. Show file size and status.

    log    (history)
    ----------------------------------------
    Syntax:    st [global_opts] diff [-r revision] [--filter ...] <files...>
        Show logs.

    status
    ----------------------------------------
    Syntax:    st status
        Update file status.

    tag    (lable / apply-label)
    ----------------------------------------
    Syntax:    st [global_opts] tag [--filter "fileStatus"] 
                [--vl "labelName"|--vd "asOfDate"|--vn revision]
                --label "labelName" [files...]
        Apply a already exist lable to file(s).

    describe (dsc)
    ----------------------------------------
    Syntax:    st dsc -m "message" <files>
        Change the desciption of file(s).

    release    (remove /rm)
    ----------------------------------------
    Syntax:    st [global_opts] rm [--filter ...] <files...>
        Remove Local files.

    remove-repos (rm-repos)
    ----------------------------------------
    Syntax:    st [global_opts] rm-repos [--filter ...] <files...>
        Remove files from version control.

    undelete
    ----------------------------------------
    Syntax:    st undelete
        Only be can be done in GUI mode.

    lock
    ----------------------------------------
    Syntax:    st lock 
        Lock and Unlock files.

    mk-build-label
    ----------------------------------------
    Syntax:    st mk-build-label
        Make a build label.

    mk-revision-label
    ----------------------------------------
    Syntax:    st mk-revision-label
        Make a revision label.

    mk-view-label
    ----------------------------------------
    Syntax:    st mk-view-label
        Make a view label.

    admin
    ----------------------------------------
    Syntax:    st admin --server <server> --pwdfile <pwdfile> [lock|unlock]
        Server admistration command. Lock/Unlock server.


    update this script and other scripts:
        st getst
        st putst

    Filters:
        C: Current
        G: Merge
        I: Missing
        M: Modified
        N: Not in view
        O: Out Of Date
        U: Unknown
"st getst" : Update your st immediately.