How to list SVN tags and its revisions from command line

℡╲_俬逩灬. 提交于 2019-12-05 12:05:45

问题


I need revisions of different tags. So far I used a Tag-Browser in SmartSVN. However it is quite slow.

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.

Is there a svn command to get only tags and its revision?


回答1:


You can see the revision numbers of the most recent commit for each tag by adding the option -v:

svn ls -v ^/tags

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)'))


来源:https://stackoverflow.com/questions/17658065/how-to-list-svn-tags-and-its-revisions-from-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!