linux下向clearcase中提交多级目录(clearcase add to source recursively)
2011-08-02 15:43
330 查看
现在开始了新的工作,工作中使用到的代码管理工具是clearcase。但是它在提交多级目录时很是麻烦,所以自己写了个脚本。
放在这里,给需要的用户。
使用方法是:
./add_source.sh dir
需要注意的是 需要提交的目录下的东西都是自己新建的,否则会出错直接退出
放在这里,给需要的用户。
使用方法是:
./add_source.sh dir
需要注意的是 需要提交的目录下的东西都是自己新建的,否则会出错直接退出
#!/bin/bash #list result analyzer added but not check in java file TMPFILE="/tmp/tmp_file" TMPFILE2="/tmp/tmp_file2" CT="/usr/atria/bin/cleartool " CTCO="/usr/atria/bin/cleartool co -nc " CTCI="/usr/atria/bin/cleartool ci -nc " CTMKELEM="/usr/atria/bin/cleartool mkelem -mkpath -nc " WORKSAPCE="" CURRENTPATH="" function cleantmpfile() { rm -rf $TMPFILE $TMPFILE2 } if [ $# -ne 1 ] then echo "usage: ./add_source.sh dir" echo "for example, ./add_source.sh /tmp/ab" echo "/tmp path must be under VOBs, your created directory ab, ab/cd, etc" echo "then this shell will check in all the directory and file to clearcase." exit fi function checkexitcode() { if [ "$?" -ne "0" ]; then echo "##############################" echo "Sorry, command executed error." echo "##############################" exit 1 fi } cleantmpfile #backup current path CURRENTPATH=$(pwd) cd $1 WORKSAPCE=$(pwd) echo -n "Your parameter is: " echo $WORKSAPCE #check out current path's parent cd .. $CTCO . #find all dirctories/files in user input find $WORKSAPCE -type d -print > $TMPFILE find $WORKSAPCE -type f -print > $TMPFILE2 #add all dir to clearcase echo "mkelem all directories" while read LINE do echo $LINE $CTMKELEM $LINE checkexitcode done < $TMPFILE #make sure file under directory is add to clearcase echo "check in all files" path="" while read FILE do echo $FILE #path=$(dirname $FILE) #cd $path $CTMKELEM $FILE checkexitcode #check in file $CTCI $FILE checkexitcode done < $TMPFILE2 #check all dir echo "check out all directories" while read LINE do $CTCI $LINE checkexitcode done < $TMPFILE $CTCI . #restore path cd $CURRENTPATH
相关文章推荐
- Add a system call to linux source
- ClearCase当中add to source control出错解决
- Linux学习--第十一天--source、环境变量目录、欢迎信息、正则、cut、awk、sed、sort、判断表达式、if、for、case、一些脚本
- linux下svn提交文件后自动更新到web目录中
- linux 递归删除多级目录
- CocoaPods解决Unable to add a source with url ...
- rational clearcase 提交活动注意
- Unable to load the mojo 'add-source' from the plugin 'org.codehaus.mojo:build-helper-maven-plugin:1.
- How to use “svn add” recursively in Linux shell?
- linux环境下svn提交自动同步到web目录
- VS2005,Did you forget to add '#include "stdafx.h"' to your source?
- CHtmlEditCtrl (2): Add a Source Text Editor to Your HTML Editor
- linux下svn提交忽略某些文件、目录(ignore属性)
- How to Rename a View in ClearCase
- 【LINUX】SVN 代码提交之后。同步到web目录下
- How to Linux and Open Source -- Tip 23 : look
- maybe useful for Add the solution to source control
- linux创建多级目录
- iOS - 解决Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named
- [Linux]A Shell to Export Source From SVN