【发布时间】:2018-06-28 12:56:29
【问题描述】:
我目前正在开发一个 Qt c++ 项目,该项目基本上打印特定 SVN 存储库的 2 个特定修订版(用户输入存储库和修订版)之间的所有提交日志消息。
我需要获取 repo URL 中的修订计数。
我想在 Windows 10 上执行此操作,所以我猜批处理命令可能非常有用。
我正在使用 Visual SVN 服务器和 Tortoise SVN。
(如果需要,我的 Qt 版本是 5.11.1)
我有一个批处理脚本,可以打印 .txt 文件的 2 个特定修订版本之间的所有日志。
是这样的:
@ECHO OFF
REM This Script Takes all the logs between a given repository's 2 specific revision.
REM Below, we store the first parameter which is the URL of the Repository that is wanted.
SET urlOfRepository=%1
REM Below, we store the second parameter which is the first revision that is wanted.
SET firstRevision=%2
REM Below, we store the third parameter which is the second revision that is wanted.
SET secondRevision=%3
REM Below is the command for getting all the log messages between the first and the second revision that is wanted in the wanted repository and printing to a .txt file.
svn log -r %firstRevision%:%secondRevision% --limit %secondRevision% %urlOfRepository% > svnLog.txt
EXIT /B 0
如果有人可以帮助我,我会很高兴。
如果需要,我可以进一步澄清问题,因此请随时通过 cmets 与我联系。
提前致谢。
感谢 Kostix,答案是:
svn info -r HEAD --show-item revision %URL%
我已经编写了一个脚本来解决我的问题。这里是:
@ECHO OFF
REM This Script writes the revision count of a specific SVN repository
REM Below, we store the first parameter which is the URL of the Repository that is wanted.
SET urlOfRepository=%1
REM Below, is the command that returns the count of revisions in the specifically given SVN repository and writes to a .txt file
svn info -r HEAD --show-item revision %urlOfRepository% > svnCountOfRepoRevisions.txt
EXIT /B 0
【问题讨论】:
-
将定义添加到 makefile
DEFINES += "SVN_REV=\"\\\"$(shell svnversion -n)\\\"\""它会给你当前的 svn 版本。
标签: qt batch-file svn tortoisesvn visualsvn-server