14
svn get revision on Windows
source link: https://naclyen.com/2020/04/22/svn-get-revision-on-windows/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Windows 10
svn, version 1.13.0 (r1867053)
PSVersion 5.1.18362.752
方法一 – show-item
- 最直接的方式, 沒有之一!!
- Subversion 1.9 新增的 svn info –show-item=arg
>svn info --show-item=revision https://svn.apache.org/repos/asf/subversion/trunk 1876820
- 範例
- batch
要透過特別的手法把值塞進去有點不直觀就是…>for /f %%a in ('svn info --show-item=revision https://svn.apache.org/repos/asf/subversion/trunk') do set r=%%a >echo %r% r is 1876820
- PowerShell
>$r = $(svn info --show-item=revision https://svn.apache.org/repos/asf/subversion/trunk) >$r 1876820
- batch
方法二 – xml
- PowerShell only
將 svn info 轉成 xml 格式並直接使用, 怎可以這麼好用!!
最前面的[xml]
是 cmd 的一部分, 我一開始整個忽略它XDD>[xml]$info_xml = svn info --xml https://svn.apache.org/repos/asf/subversion/trunk >$info_xml.info.entry.revision 1876820
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK