git-starteam使用详解

        git-starteam是一个将StarTeam转换成git的工具。

        5年StarTeam和2年git的使用经历,我对比得出StarTeam适合于管理文档、git适合于管理代码的结论。

       文档不像代码那样需要让所有相关的.c、.h文件同时处于一个提交点版本上以备日后比如寻找Bug时一起回溯,反而是用户只会关心文档的最新版、文档本身这单独一个文件的修改历史以及这个文件是否能被单独从数据库中检出,StarTeam满足这些条件,而git在使用时会一次性检出所有的文件。以前曾试验过用网页形式的wiki语法来写文档,后来发现效果不好,因为很多网上下载的技术资料是pdf、html或doc格式的,如果让技术人员再去将内容手工转换成wiki格式的文本那就是舍本逐末了,而后来用StarTeam建的共享知识库还是比较好用的。

        代码需要经常改动许多文件才能共同完成或试验某个功能,git的无痛分支功能正满足了程序员的这个需求,而StarTeam的分支、合并就是一场噩梦。这几年找过几次将StarTeam转换成git的工具,而发现没有可用工具时曾试过手动将StarTeam的Label检出再检入git,勉强能用,但丢失了大量历史信息,使得无法再在gitk --all图形界面中查找某行代码是在哪个时间点被谁修改的……

        终于,前段时间再次寻找时发现了https://github.com/planestraveler/git-starteam ,虽然还只能将StarTeam中最新版本的各个文件按照时间排序和注释分类转换进git、仍旧处于雏形阶段,不过好在自己对StarTeam有过深入研究,并得益于github网站fork出源代码、做出修改后发送pull request给原作者的功能,我在自己的https://github.com/flyskywhy/git-starteam 中达到了保留所有历史信息(几乎所有,我是用每隔24小时的View Configuration来转换一次,而且StarTeam追溯代码历史的不便也使得程序员一般没有动力在24小时内将同一个源代码文件上传两次到StarTeam上)、将其它View转换为git中的分支、针对某个目录进行转换(StarTeam管理的项目中一般会将编译工具、源代码、文档等分目录存放,而git管理的项目一般会将这些分成几个.git仓库存放)的功能。

        git-starteam的使用方式,如我在https://github.com/flyskywhy/git-starteam/blob/master/README 中所补充描述的,在git clone https://github.com/flyskywhy/git-starteam.git 之后,按如下方式操作即可:

Build with starteam80 API:
cd ~/proj/git-starteam/
scons --jargs /usr/share/java/jargs.jar --starteam /opt/StarTeamCP_2005r2/lib/starteam80.jar bin/syncronizer.jar
(If not starteam80, maybe you should modify generateFastImportStream() in syncronizer/src/org/sync/GitImporter.java, for
 http://techpubs.borland.com/starteam/2009/en/sdk_documentation/api/com/starbase/starteam/CheckoutManager.html said old version (passed in /opt/StarTeamCP_2005r2/lib/starteam80.jar) "Deprecated. Use View.createCheckoutManager() instead.")

Prepare before Run:
In Linux, the default max "open files" is 1024 (`ulimit -a`). Maybe you will get "java.io.IOException: Too many open files" if your StarTeam project had checked in too many files in one time, then you should add "* - nofile 65536" line to /etc/security/limits.conf and re-login to shell.
In Windows, the default max "open files" is 16384.

Run with starteam80 API:
1. Create bin/.git/ folder from a StarTeam project named Prime with Prime view:
cd ~/proj/git-starteam/bin/
java -cp .:/usr/share/java/jargs.jar:/opt/StarTeamCP_2005r2/lib/starteam80.jar:./syncronizer.jar:../lib/org.eclipse.jgit-0.12.1.jar org.sync.MainEntry -h 192.0.1.102 -P 49203 -p Prime -v Prime -H master -U UserName -d gmail.com -f Src/apps/vlc2android/ -c
Or, it's a good idea to add .gitignore first, so you can do below instead:
cd ~/proj/git-starteam/bin/
echo "*.o" > .gitignore
git add .gitignore
git commit -m "Init with .gitignore"
java -cp .:/usr/share/java/jargs.jar:/opt/StarTeamCP_2005r2/lib/starteam80.jar:./syncronizer.jar:../lib/org.eclipse.jgit-0.12.1.jar org.sync.MainEntry -h 192.0.1.102 -P 49203 -p Prime -v Prime -H master -U UserName -d gmail.com -f Src/apps/vlc2android/ -R


2. Add other branch to bin/.git/ folder from other view:
In gitk --all, create OtherView branch base on the commit which time is nearest before "StarTeam->View->Properties->Type->Parent Configuration" of the Other View.
java -cp .:/usr/share/java/jargs.jar:/opt/StarTeamCP_2005r2/lib/starteam80.jar:./syncronizer.jar:../lib/org.eclipse.jgit-0.12.1.jar:/usr/lib/jvm/java-1.6.0-sun/jre/lib/ org.sync.MainEntry -h 192.0.1.102 -P 49203 -p Prime -v "Other View" -H other-view -U UserName -d gmail.com -f Src/apps/vlc2android -R

3. Get the repository:
cd /pub/gittrees/
git clone --bare ~/proj/git-starteam/bin/.git vlc2android.git

4. Delete bin/.git/ folder
cd ~/proj/git-starteam/bin/
rm .git/ -fr

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值