rgm
rgm

Reputation: 1281

getting tortoise svn version to python binary from py2exe

I generated a py2exe binary of my project. I use TortoiseSVN. How do I extract the SVN Revision Number (which I later need to incorporate into the binary). Do I need to implement the same in Python? If so, how do I go about the same?

Upvotes: 0

Views: 666

Answers (1)

David Heffernan
David Heffernan

Reputation: 613013

You need to execute this command:

svn info path/to/working/copy

and then parse the output. The output looks a little like this:

Path: path/to/working/copy
Working Copy Root Path: blah blah
URL: https://blah blah
Repository Root: https://blah blah
Repository UUID: blah blah
Revision: 42
Node Kind: directory
Schedule: normal
Last Changed Author: blah blah
Last Changed Rev: 42
Last Changed Date: 2013-02-25 09:52:55 +0000 (Mon, 25 Feb 2013)

Use subprocess.check_output to execute the svn command and read in the output. Then parse it however you feel like. For example you could use a simple regex with re to find the information.

Upvotes: 1

Related Questions