[英]Getting a set of revisions from SVN in Windows batch script
I'm writing a script for synchronisation of SVN repositories.我正在编写一个用于同步 SVN 存储库的脚本。 It's my first Windows batch script, so I have some problems with it.
这是我的第一个 Windows 批处理脚本,所以我遇到了一些问题。 I use "svn log -q" command which gives revision numbers like this that are stored in SVN_LOG_Q_FILE:
我使用“svn log -q”命令给出这样的修订号,这些修订号存储在 SVN_LOG_Q_FILE 中:
------------------------------------------------------------------------
r4 | username | 2011-05-26 13:31:04 +0100
------------------------------------------------------------------------
r3 | username | 2011-05-26 13:27:33 +0100
------------------------------------------------------------------------
r2 | username | 2011-05-26 15:39:29 +0100
------------------------------------------------------------------------
r1 | username | 2011-05-26 13:37:41 +0100
------------------------------------------------------------------------
What I'd like to get is only revision numbers.我想得到的只是修订号。 I use below code for getting revisions, but they're with leading "r" (r1, r2 etc.).
我使用下面的代码来获取修订,但它们带有前导“r”(r1、r2 等)。
for /f "usebackq tokens=1" %%g in (`findstr /r /c:"r" %SVN_LOG_Q_FILE%`) do (
echo rev %%g%
)
Can you help me?你能帮助我吗?
Thanks in advance, szeldon在此先感谢,塞尔登
A simple FOR /F with the delims <space>
and r
should work, as there is always a space behind the r.带有分隔符
<space>
和r
的简单 FOR /F 应该可以工作,因为 r 后面总是有一个空格。
for /f "usebackq tokens=1 delims=r " %%g in ("%SVN_LOG_Q_FILE%") do (
echo rev %%g
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.