Using PHP, Perl, or Python (preferably PHP), I need a way to query an SVN database and find out the last revision number sent to SVN. I don't need anything other than that. It needs to be non-intensive (so I do it every 5 minutes as a cron job; SVN's performance should not be affected).
SVN is located on my Intranet, but not my specific computer.
I have SVN installed, but no bindings installed for PHP/Perl/Python. I'm running Windows XP, but I would prefer a platform-independent solution that can also work in Linux. If you have a Linux-only (or XP-only) solution, that would also be helpful.
$ svn log | head -10
on whatever directory that has a.svn
folderThe following should work:
It returns a single revision number.
Starting with Subversion 1.9 you can use option --show-item to get a value of one of fields of
svn info
command's output. This command will display revision number only:Get XMLed output of svn info using
--xml
option and use PowerShell to get the revision number. Here is a simple example:Using VisualSVN Server 3.4 or newer, you can get the number of revisions in a repository by running these commands:
$repo = Get-SvnRepository <REPOSITORY-NAME>
$repo.Revisions
See
Get-SvnRepository
PowerShell cmdlet reference for more information.Update: Subversion 1.9 will support a new command "svn youngest" that outputs only the latest revision number. The difference to "svnlook youngest" is that "svn youngest" also works remotely.
http://subversion.tigris.org/issues/show_bug.cgi?id=4299
You can try the below command:
This will get just the revision number of the last changed revision:
I hope this helps.