如何使用ant获取最后一次svn提交的用户名? [英] How to get the username of the last svn commit using ant?

查看:30
本文介绍了如何使用ant获取最后一次svn提交的用户名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 Ant 来获取 svn 存储库最新提交的用户名.

我怎样才能尽可能跨平台地做到这一点?

谢谢!

解决方案

所以,这里是svnant"的例子:

<fileset dir="devlib" includes="**/*.jar"/></路径><typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="devlibs.path"/><svn设置id="svn.settings"svnkit=假"javahl="假"用户名="${svn.username}"密码="${svn.password}"/><目标名称="get-svn-author"><svn refid="svn.settings"><singleinfo target="${svn.repo.url}" property="author.result" request="author"/></svn><echo message="上次提交的作者:${author.result}"/></目标>

您应该将svnant.jar"和svnClientAdapter.jar"放在devlibs.path"标识的路径中.以及javahl"或svnkit"所需的其他库到您的${ANT_HOME}/lib".

如果您有 1.6 格式的 SVN 存储库,则可以使用svnkit"(在svnSetting"-block 中设置为true").因为svnkit"是一个纯 Java 工具包,所以最好在需要跨平台解决方案时使用.如果您已经切换到 1.7,那么我建议使用 SVN 命令行客户端(在我的示例中为命令行客户端配置了svnSetting").查看此页面 (Slik SVN) 以获取有关在哪里可以找到以及如何安装不同 SVN 命令行客户端的信息.>

I would like to use Ant to get the username of the latest commit of a svn repository.

how can i do this as cross-platform as possible?

thanks!

解决方案

So, here is example for "svnant":

<path id="devlibs.path">
    <fileset dir="devlib" includes="**/*.jar" />
</path>

<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpathref="devlibs.path" />

<svnSetting
        id="svn.settings"
        svnkit="false"
        javahl="false"
        username="${svn.username}"
        password="${svn.password}" />

<target name="get-svn-author">
    <svn refid="svn.settings">
        <singleinfo target="${svn.repo.url}" property="author.result" request="author" />
    </svn>

    <echo message="Author of last commit: ${author.result}" />
</target>

You should put "svnant.jar" and "svnClientAdapter.jar" to path identified by "devlibs.path". And other libraries required by "javahl" or "svnkit" to your "${ANT_HOME}/lib".

If you have SVN repository with 1.6 format, you could use "svnkit" (set to "true" in "svnSetting"-block). Because "svnkit" is a pure Java-toolkit it's best to use when you need cross-platform solution. If you already switched to 1.7, then I recommend to use SVN command line client ("svnSetting" configured for command line client in my example). Check this page (Slik SVN) for info about where to find and how to install different SVN command line clients.

这篇关于如何使用ant获取最后一次svn提交的用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆