发新话题
打印

[原创] 一个生成分支和合并分支的脚本( 此文章被查看:1418次,被回复:7篇!! )

一个生成分支和合并分支的脚本

支持三个功能:
1.生成一个分支:
   crcvs.bat start branchname
2.合并两个分支,这里加了一些branch 名字的check,开发branch必须含有"BR",集成branch含有"INT"
   如不需要可以去掉,或者改成自己的命名规则.
  crcvs.bat merge2bran frombranchname tobranchname
3.合并到主分支
  crcvs.bat merge2main frombranchname
4.help
   crcvs.bat help
   crcvs.bat -h

这是我在工作中自己写的,不知有没有人感兴趣,感兴趣的话我就贴出来,赚点钱去买人家东西,呵呵



© 本文为 一线舞月SCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系管理员

TOP

没人感兴趣吗?很遗憾的问一下........



© 本文为 一线舞月SCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系管理员

TOP

呵呵,楼主别光说不练,先把脚本贴出来再说。

是金子总会发光的。



© 本文为 懂你SCMLife 共同所有,未经同意,请勿转载 ©如该文侵犯了您的版权,请联系管理员
优惠购买Rational,Telelogic,Hansky产品,企业VIP服务、实施
VIP服务电话:13581809377

TOP

感兴趣~!
楼主贴出来,大家一起看看!

© 本文为 selina 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员
我选择,我喜欢

TOP

呵呵,贴出来给大家看看还有什么改进得地方,感觉还不是很完美:
echo off
set updatemodule=TESTPROJECT\MODULE1
set branchmodule=TESTPROJECT\MODULE1

if "%1" == "" goto _help
if "%1" == "help" goto _help
if "%1" == "-help" goto _help
if "%1" == "h" goto _help
if "%1" == "-h" goto _help
if "%1" == "start" goto _start
if "%1" == "merge2bran" goto _merge2bran
if "%1" == "merge2main" goto _merge2main


:_help
@echo commond usage
@echo     crcvs.bat start branchname: to start one branch from mainline
@echo     crcvs.bat merge2bran frombranchname tobranchname: merge from one branch to another branch                             
@echo     crcvs.bat merge2main Intbranchname: merge from integration branch to main branch
@echo     crcvs.bat help: get usage help
goto _over


::start to create  branch
:_start
@if "%2" == "" goto _noticketerror
::validate the branch name, must be integration branch or develop branch
echo %2 | find "INT"
if errorlevel 2 goto _fail
if errorlevel 1 goto _validateBR
goto _valid

:_validateBR
echo %2 | find "BR"
if errorlevel 2 goto _fail
if errorlevel 1 goto _invalid
goto _valid

:_invalid
echo branch name is invalid, should be like "<user-id>_<cr-id>_BR"
echo or "<platform name><platform number>_INT"
goto _fail

:_valid
echo start branch %2 on module %module%
echo Get latest version from mainline
call cvs update -P -A %updatemodule%
if errorlevel 1 goto _fail
@echo creating branch........
@call cvs rtag -b %2 %branchmodule%
if errorlevel 1 goto _fail
@echo update files........
@call cvs update -RPd -r %2 %updatemodule%
if errorlevel 1 goto _fail
goto _done


:_merge2bran
@if "%2" == "" goto _noticketerror
@if "%3" == "" goto _noticketerror
@echo will merge from branch %2 to branch %3 on module %module%
@echo Get latest version from branch %3
@call cvs update -P -r %3 %updatemodule%
if errorlevel 1 goto _fail
@echo merge files........
@call cvs update -d -j %3 -j %2 %updatemodule%
if errorlevel 1 goto _fail
@echo Merge files finished, please review files that got merged and
@echo then run "cvs commit" to commit all changes to cvs
goto _done


:_merge2main
@if "%2" == "" goto _noticketerror
@echo will merge from branch %2 to main branch  on module %module%
@echo Get latest version from main branch
@call cvs update -PA %updatemodule%
if errorlevel 1 goto _fail
@echo merge files........
@call cvs update -d -j %2 %updatemodule%
if errorlevel 1 goto _fail
@echo Merge files finished, please review files that got merged and
@echo then run "cvs commit" to commit all changes to cvs
goto _done

:_noticketerror
  @echo please input branch name
goto _over

:_wrongname
echo wrong branchname
goto _over

:_done
echo done
goto _over

:_fail
echo failed


:_over

© 本文为 一线舞月 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

另外:在想一个一个问题,在merge两个branch以后,如何发现有冲突的所有文件,并有效的解决冲突?
难道除了手工check,就没有其他方法了吗?

© 本文为 一线舞月 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

虚心问下:这是用在CVS的吗?起什么作用啊……对开发人员有何帮助,还是对管理员有何帮助。

© 本文为 smallfish382 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

啊?好受打击哦.难道这么不值钱?

是给cvs用的啊,用来生成branch和合并branch啊,当然如果只在mainline上面开发的话是用不到这个的,但是如果有多个branch开发就用到了,比如开发人员拉开发branch出来,集成人员拉集成branch.
其实关键是各种check了,真正的cvs命令可能只有几行,但是对branch名字的限制和对错误的处理要得当,

© 本文为 一线舞月 所有,未经同意,请勿转载
©如该文侵犯了您的版权,请联系管理员

TOP

发新话题