Animesh D
Animesh D

Reputation: 5002

How do I get the previous revision number of an SVN repository?

I am planning to create a Powershell script that detects changes in several svn repositories and then performs some operations on each of those repositories, like copying changed files or copying the entire repository into a build site.

I have a simple function that gets the latest version of a repository:

function Get-SvnRevision($dir=".")
{
    ([xml](svn info $dir --xml)).info.entry.revision
}

My idea is that once I get the current revision number, compare it with the previous revision number and if they are not the same, then perform some operations as mentioned above.

How I get the previous revision number so that I can compare it to the latest one and then do some operations?

Upvotes: 0

Views: 705

Answers (1)

Lazy Badger
Lazy Badger

Reputation: 97365

I'll suggest to move from another side: using post-commit hooks

  • It fires automatically after each commit
  • It can be any code (Powershell also), which can be executed by server's OS
  • Subversion passes to script all needed (for svnlook subcommands in script) details (path to repo + revision id) as parameters

Upvotes: 1

Related Questions