我有适用于 clearcase 的 ant 脚本。谁能帮我把它转换成 GIT

I have ant script which works for clearcase. Can any one help me to convert it to GIT

我正在将一个应用程序从 clear case 迁移到 GIT。编写构建脚本以增加内部版本号,并且是根据明确的案例编写的。现在我必须让它为 GIT 工作。任何人都请帮助我修改以下代码以使其适用于 GIT。 我已将可执行文件路径更改为 GIT.exe。所以我只是帮助将清晰的大小写命令转换为 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>

相当于:

如果您真的只想更新一个文件setenvs.bat,您需要:

git fetch
git checkout HEAD -- setenvs.bat

git checkout不是 cleartool checkout (co):它更新文件内容,它不"creates a writable copy"。
请参阅“What is the difference between a reserved checkout and an unreserved checkout?”,我将其与 Git.

进行了比较

即:

git add setenvs.bat
git commit -m "bump version number"
git push

中查看更多关于 ClearCase 和 Git 的区别
  • "What are the basic ClearCase concepts every developer should know?"(2009 年 3 月)
  • "ClearCase advantages/disadvantages"