如何从命令行列出SVN标签及其修订版本 [英] How to list SVN tags and its revisions from command line
问题描述
我需要修改不同的标签。到目前为止,我在SmartSVN中使用了标记浏览器。但是它是相当缓慢。
I need revisions of different tags. So far I used a Tag-Browser in SmartSVN. However it is quite slow.
像 svn ls^ / tags
只显示标记,但没有修订。
和类似
Something like svn ls "^/tags"
shows only the tags but no revisions.
And something like
svn log /path/to/tag -v --stop-on-copy
会提供不必要的混淆信息。
gives too much confusing information which is not needed.
是否有一个svn命令只获取标签及其修订版?
Is there a svn command to get only tags and its revision?
推荐答案
通过添加选项 -v
为每个标记添加:
You can see the revision numbers of the most recent commit for each tag by adding the option -v
:
svn ls -v ^/tags
如果要处理结果,建议使用命令行 svn info --xml --depth = immediates ^ / tags
并使用脚本解析XML文档。例如,以下python脚本打印标签的名称及其修订版本号:
If you want to process the results, I recommend using the command line svn info --xml --depth=immediates ^/tags
and parsing the XML document with a script. For example, the following python script prints the names of the tags with their revision number:
#! /usr/bin/env python3
import sys, lxml.etree
document = lxml.etree.parse(sys.stdin.buffer)
for entry in document.xpath('//entry[@kind="dir"]'):
print(entry.xpath('string(@path)'), entry.xpath('string(commmit/@revision)'))
这篇关于如何从命令行列出SVN标签及其修订版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!