How do you determine the latest SVN revision number rooted in a directory?

前端 未结 10 1699
北恋
北恋 2020-12-02 15:45

I would like to start tagging my deployed binaries with the latest SVN revision number.

However, because SVN is file-based and not directory/project-based, I need to

10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 16:26

    For me the best way to find out the last revision number of the trunk/branch is to get it from the remote URL. It is important NOT to use the working dir because it may be obsolete. Here is a snippet with batch ( I hate a much ;-)):

    @for /f "tokens=4" %%f in ('svn info %SVNURL% ^|find "Last Changed Rev:"') do set lastPathRev=%%f
    
    echo trunk rev no: %lastPathRev%
    

    Nevertheless I have a problem to hardcode this number as interim version into sources containing $Rev:$. The problem is that $Rev:$ contains the file rev. no. So if trunk rev no is larger then the rev no of version file, I need to modify this file "artificially" and to commit it to get the correct interim version (=trunk version). This is a pane! Does somebody has better idea? Many thanks

提交回复
热议问题