How to access the current Subversion build number?

前端 未结 16 2149
刺人心
刺人心 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:09

    Have your build process call the svnversion command, and embed its output into generated {source|binaries}. This will not only give the current revision (as many other examples here do), but its output string will also tell whether a build is being done in a mixed tree or a tree which doesn't exactly match the revision number in question (ie. a tree with local changes).

    With a standard tree:

    $ svnversion
    3846
    

    With a modified tree:

    $ echo 'foo' >> project-ext.dtd
    $ svnversion                   
    3846M
    

    With a mixed-revision, modified tree:

    $ (cd doc; svn up >/dev/null 2>/dev/null)
    $ svnversion
    3846:4182M
    

提交回复
热议问题