Getting the subversion repository number into code

前端 未结 6 391
醉梦人生
醉梦人生 2020-11-30 01:24

I\'d like to implement a way of recording the version of a project within code, so that it can be used when testing and to help track bugs. It seems the best version number

6条回答
  •  鱼传尺愫
    2020-11-30 01:31

    While nifty, the revision keyword trick only updates the file when it's changed in that revision - if you don't change the file, then it will continue to reflect the old revision.

    If you want the software to always reflect the overall revision number, then you'll have to delve into the relevant SVN entries file and extract it, which isn't too difficult (it's an XML file).

    Wikipedia does this on their version page to indicate the revision of the software that's running live; the code is here - look for the getSvnRevision() method.

提交回复
热议问题