1

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="&quot;bump version number&quot;"/>
                <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="&quot;bump version number&quot;"/>
                <arg value="setenvs.bat"/>
            </exec>
        </try>
        <catch>
            <echo>Increment build number failed: ${exception}</echo>
            <antcall target="buildfailed"/>
            <fail>${exception}</fail>
        </catch>
    </trycatch>
</target>
Gyro Gearless
  • 5,131
  • 3
  • 18
  • 14
jon
  • 213
  • 1
  • 5
  • 18

1 Answers1

1

The equivalent for:

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

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks a lot. I will try and let you know the result. Can you please let me know what to do with the line. do I need to change it ? – jon Jun 26 '19 at 08:18
  • @jon : no, it is the comment you add to your git commit (to record the change). I have edited the answer to reflect that. – VonC Jun 26 '19 at 08:22
  • Kindly help me with this error :- https://stackoverflow.com/questions/56786767/ant-script-failing-with-error-source-file-does-not-exist-despite-the-file-exis – jon Jun 27 '19 at 08:46