svncommand-linetagsrevisions

How to list SVN tags and its revisions from command line


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?


Solution

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