I am migrating one application from clear case to GIT. A build script is written to increment build number and it is written with respect to clear case. And now I have to make it work for GIT. Anyone kindly help me to modify below code to make it work for GIT. I have changed the executable path to GIT.exe. So I just help to convert clear case commands to GIT.
<target name="decBuildNo">
<trycatch property="exception">
<try>
<exec dir="${basedir}\calcBuild" executable="${cleartool}" failonerror="true">
<arg value="update"/>
<arg value="setenvs.bat"/>
</exec>
<!-- update the build number in setenvs.bat and check in-->
<exec dir="${basedir}\calcBuild" executable="${cleartool}" failonerror="true">
<arg value="co"/>
<arg value="-c"/>
<arg value=""bump version number""/>
<arg value="setenvs.bat"/>
</exec>
<decrbuild buildNumberKey="CALCMGR_BUILD_NO" fileName="${basedir}\calcBuild\setenvs.bat"/>
<exec dir="${basedir}\calcBuild" executable="${cleartool}" failonerror="true">
<arg value="ci"/>
<arg value="-c"/>
<arg value=""bump version number""/>
<arg value="setenvs.bat"/>
</exec>
</try>
<catch>
<echo>Increment build number failed: ${exception}</echo>
<antcall target="buildfailed"/>
<fail>${exception}</fail>
</catch>
</trycatch>
</target>
The equivalent for:
cleartool update
would be git pull
(provided the Git repository is already cloned)If you really want to update only one file setenvs.bat
, you would need:
git fetch
git checkout HEAD -- setenvs.bat
git checkout
is not cleartool checkout (co)
: it updates the file content, it does not "creates a writable copy".
See "What is the difference between a reserved checkout and an unreserved checkout?", where I do compare it with Git.
cleartool co -nc ...
: no need, a Git repository is in read/write locally. There is no "cleartool checkout
" needed.
cleartool ci
: you would need to add, commit and push
That is:
git add setenvs.bat
git commit -m "bump version number"
git push
See more on the difference between ClearCase and Git in