How to access the current Subversion build number?

前端 未结 16 2166
刺人心
刺人心 2020-11-27 05:43

How can you automatically import the latest build/revision number in subversion?

The goal would be to have that number visible on your webpage footer like SO does.

16条回答
  •  再見小時候
    2020-11-27 06:01

    svn info 
    

    or

    svn info --xml 
    

    Then look at the result. For xml, parse /info/entry/@revision for the revision of the repository (151 in this example) or /info/entry/commit/@revision for the revision of the last commit against this path (133, useful when working with tags):

    
    
    
    http://myserver/svn/stumde/cmdtools
    
    http://myserver/svn/stumde
    a148ce7d-da11-c240-b47f-6810ff02934c
    
    
    mstum
    2008-07-12T17:09:08.315246Z
    
    
    
    

    I wrote a tool (cmdnetsvnrev, source code included) for myself which replaces the Revision in my AssemblyInfo.cs files. It's limited to that purpose though, but generally svn info and then processing is the way to go.

提交回复
热议问题