clearcase的常用配置(原创)
又要用clearcase来做事了,点点滴滴都记录下来,以备查考(注:还是喜欢svn)。
1. 简写
为了避免输入clearcase云云,特此简写!在~/.bashrc中追加输入如下内容:
1 echo "source ${HOME}/.bashrc"
2 export PS1=\\u@\\h:\$PWD\\$
3 #dangerous option, auto correct the typo. dangerous in rm
4 #shopt -s cdspell
5 #command="EUSER=`id|awk '{print $1}'|sed -e s/.*\(// -e s/\)$//`"
6 #export PROMPT_COMMAND='eval $command;echo -ne "\033]0;$EUSER@$HOSTNAME:${PWD}\007"'
7 . $HOME/.profile.common
8
9 alias ls="ls --color=auto"
10 alias l="ls"
11 alias ll="ls -l"
12 alias la="ls -al"
13 alias ct="/opt/rational/clearcase/rhat_x86/bin/cleartool"
14
15 alias astyle="~/apps/astyle/build/gcc/bin/astyle --style=ansi -s4 -S -N -L -m0 -M40 -U --convert-tabs --suffix=.pre "
16 alias pentium3-gcc="/opt/montavista-4.0.1/cge/devkit/x86/pentium3/bin/pentium3-gcc"
17
18 alias myview="ct lsview | grep wenxian |awk '{print NR \$0}'"
19 alias myco="ct lsco -r | grep wenxian"
20
21 export TERM=xterm-color
22
23 alias mkview="python ~/apps/mkview.py"
24 alias rmview="ct rmview -tag"
25 alias setview="python ~/apps/setview.py"
26 alias pwview="ct pwv"
27
28 alias newbranch="/vobs/MX_PACKAGING/scripts/create_dev_branch.pl"
2. mkview.py 内容
1 import sys, os
2
3 ERR_ARG_MSG = r"Error Arguments!"
4 PATH=r"/net/sbardy0f/vol/cc_stg_y0a/Views/MxPF/"
5 H_PATH=PATH
6 G_PATH=PATH
7
8 if __name__ == "__main__":
9 if len(sys.argv) != 2:
10 print ERR_ARG_MSG
11 sys.exit()
12 else:
13 myViewTag = sys.argv[1]
14 outputInfo = os.popen("cleartool mkview -tag %s -region MX.UX -host sbardy0a -hpath %s%s.vws -gpath %s%s.vws %s%s.vws " % (myViewTag, H_PATH, myViewTag, G_PATH, myViewTag, PATH, myViewTag)).read()
15 print outputInfo
3. setview.py 内容
1 import sys, os
2
3 ERR_ARG_MSG_NUMBER = r"Error Arguments Number!"
4 ERR_ARG_MSG_NOTINT = r"View Number Must be an Integer!"
5 ERR_ARG_MSG_OUTRANGE = r"No Such View Number!"
6
7 def errExit(errMsg = ERR_ARG_MSG_NUMBER):
8 print errMsg
9 sys.exit()
10
11 if __name__ == "__main__":
12 if len(sys.argv) != 2:
13 errExit()
14 else:
15 try:
16 viewNum = int(sys.argv[1])
17 except:
18 errExit(ERR_ARG_MSG_NOTINT)
19 viewName = os.popen(r"cleartool lsview | grep wenxian |awk 'NR == %d {print $2}'" % viewNum).read().strip()
20
21 if len(viewName) == 0:
22 errExit(ERR_ARG_MSG_OUTRANGE)
23 else:
24 # print r"cleartool setview %s" % viewName
25 outputInfo = os.system(r"cleartool setview %s" % viewName)
4. create_dev_branch.pl 就不贴了。