Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display SVN revision on web site dynamically?

My web site is a checkouted version of SVN repo. I mean .svn folders are placed on web server. I don't use web publishing.

And I want to display current project revision (whole web site) in footer. How can I do that?

If I were using web publishing, I could determine revision on build/publish and write it as static html.

So how to get revision dynamically? Read .svn files directly? Are there better ways?

I saw other such questions, but answer was using SubWCRev.exe, it isn't unfortunately acceptable.

Edit: Tarn gave interesting idea about SVN hooks on commit. Any other ideas?

like image 498
abatishchev Avatar asked Mar 14 '09 13:03

abatishchev


People also ask

How do I check svn revision?

To find information about the history of a file or directory, use the svn log command. svn log will provide you with a record of who made changes to a file or directory, at what revision it changed, the time and date of that revision, and, if it was provided, the log message that accompanied the commit.

How do I find my svn revision number?

"svn info --show-item revision" will give the current revision to which the current directory is updated.

How can I get previous revision from svn?

Using the latest versions of Subclipse, you can actually view them without using the cmd prompt. On the file, simply right-click => Team => Switch to another branch/tag/revision.

How does svn revision number work?

Unlike most version control systems, Subversion's revision numbers apply to the entire repository tree, not individual files. Each revision number selects an entire tree, a particular state of the repository after some committed change.


1 Answers

use keyword substitution. enable substitution for the files you want to display revision information, and put a keyword, like $Revision: 144 $, there.

note that

$Rev$ expands to show the last revision in which the file changed, not the last revision to which it was updated

(see link above). if you want to show the global repository revision number, you better use svnversion.

also, see Related.

like image 117
ax. Avatar answered Sep 20 '22 16:09

ax.