windows 从 SVN 命令行中提取文件的修订号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4725322/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 16:00:37  来源:igfitidea点击:

Extracting the Revision number of a file from the SVN Command line

windowssvntortoisesvn

提问by this-Me

Hello Basically i need to extract the version info from the XML I thought of puttin the entire result to a XML file and then parse it to get the revision information.

你好 基本上我需要从 XML 中提取版本信息,我想将整个结果放入一个 XML 文件,然后解析它以获取修订信息。

i tried to output the svn info to a xml file by specifying

我试图通过指定将 svn 信息输出到 xml 文件

$ svn info C:\Projects\Foo.xml --xml C:\Projects\FileInfo.xml

Im getting errors if i try to save

如果我尝试保存,我会收到错误

$ svn info --xml C:\Projects\Foo.xml
<?xml version="1.0"?>
<info>
<entry
   kind="dir"
   path="."
   revision="1">
<url>https://rbins.com/trunk/Projects/Foo.xml</url>
<repository>
<root>https://rbins.com/trunk/Projects/</root>
<uuid>5e7d134a-54fb-0310-bd04-b611643e5c25</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
   revision="240">
<author>sally</author>
<date>2003-01-15T23:35:12.847647Z</date>
</commit>
</entry>
</info>

i do not receive error if i run

如果我运行,我不会收到错误

$ svn info C:\Projects\Foo.xml --xml

$ svn 信息 C:\Projects\Foo.xml --xml

Help me where am i going wrong also suggest me if theres any alternative available to extract the revision number of the working copy

帮助我我哪里出错了还建议我是否有任何替代方法可以提取工作副本的修订号

Thanks in advance

提前致谢

回答by Jason S

Use svnversioninstead:

使用svnversion来代替:

>C:\mydir>svnversion
1652:1653

回答by Antonio Pérez

You need to redirectsvn info's output to the file, the --xmloption takes no parameter:

您需要svn info的输出重定向到文件,该--xml选项不带参数:

svn info C:\Projects\Foo.xml --xml >C:\Projects\FileInfo.xml

svn 信息 C:\Projects\Foo.xml --xml >C:\Projects\FileInfo.xml