svn update:我可以迭代结果吗?
我在脚本(Windows 脚本 .cmd 文件)中使用 svn。
目前,它将所有文件检出到一个文件夹中,然后迭代该文件夹,将所有文件添加到主文件中,作为构建过程的一部分。类似的事情:
svn checkout --username %username% %SVNURL% %workingfolder%
FOR %%i IN (%workingfolder%\*.*) DO TYPE %%i >> %DESTFILE%
我想在初始构建之后对构建执行的操作是生成一个“更改”文件,该文件仅包含自上次构建以来已更改的文件。
我可以使用 svn update 命令而不是签出,这会给我一个正在更新的文件列表。 svn 更新参考 (svnbook.red-bean. com)
我想做的是迭代 svn 更新的结果列表,在工作文件夹中找到这些文件并将它们复制到更改文件中。
I'm using svn in a script (Windows scripting .cmd file).
Currently it checks out all files to a folder, then iterates that folder adding all the files to a master file as part of a build process. Something like:
svn checkout --username %username% %SVNURL% %workingfolder%
FOR %%i IN (%workingfolder%\*.*) DO TYPE %%i >> %DESTFILE%
What I would like to do for builds after the inital build is produce a "change" file, that only has the files included which have changed since the last build.
I can use the svn update command instead of checkout, and this gives me a list of files being updated. svn update Reference (svnbook.red-bean.com)
What I would like to do is iterate this list of results from the svn update, find these files within the working folder and copy them to a change file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以非常轻松地找到更新的文件:
您可以使用
for
命令迭代该文件的输出:You can find updated files pretty easily:
You can iterate over the output of that with the
for
command:很抱歉回答我自己的问题,这也只是部分答案,但这就是我目前所处的位置。
首先,空格的问题不仅仅是 %SVNExecutable% 中的文件路径,问题根本在于命令中的空格。
解决这个问题的方法(适用于Windows XP)是使用usebackq开关,并使用反引号`而不是普通引号。使用这个,我设法让 svn update 命令工作:
这更新了测试文件,并从初始更新结果:
这产生了结果:
我无法开始工作的最后一个剩余部分是带有正则表达式的 findstr 。当我重新添加此问题并尝试此操作时:
我收到此错误:
有两种想法是否要将此作为一个新问题开始,现在我已将此问题标记为已回答......无论如何,感谢所有帮助
Apologies for answering my own question, this is also only a partial answer but it's where I'm at currently.
Firstly, the problem with the spaces is not just with the file path in %SVNExecutable%, the problem is with spaces in the command at all.
The way to solve this problem (works on windows XP) is to use the usebackq switch, and use back quotes ` instead of normal quotes. Using this, I have managed to get the svn update command to work:
This updated the test file, and from an initial update result of:
This produces a result of:
The last remaining piece of the puzzle that I can't get to work is the findstr with regex. When I add this back in and try this:
I get this error:
Was in 2 minds whether to start this as a new question now I've marked this one as answered...anyway, all help gratefully received