4

I'm searching for a library that can extract (at least) the following information from a SVN repository (not a working copy!):

  • Revision numbers and their author & commit message
  • Changes in each revision (added, deleted, modified files)

Is there a Python library that can do this?

For the authors and commit messages, I could parse "db/revprops/0/..." (simple format), but looking for changed files does not seem so easy, so I'd rather stick with a library that supports SVN repos.

2 Answers 2

2

There are Python bindings to libsvn: http://pysvn.tigris.org/docs/pysvn.html. They facilitate doing pretty much everything the svn command line client can do.

In particular, the Client.log() method does what you are looking for.

Sign up to request clarification or add additional context in comments.

4 Comments

pysvn.Client().log("/var/svn-repos/name-of-repo-directory/") always gives me the error "pysvn._pysvn_2_6.ClientError: '/var/svn-repos/name-of-repo-directory' is not a working copy". Are we talking about the same definition of "repository"? With repository, I mean the one with "conf", "db", "hooks" subdirectories, not the working copy.
@AndiDog: Try pysvn.Client().log("file:///var/svn-repos/name-of-repo-directory/"). That's actually something quite basic in svn: Plane paths are interpreted as working copies, URIs are interpreted as repositories. I assumed you to be familiar with this because it also holds for the svn command line client, but I probably should have mentioned it.
Cool, that works. I didn't know about the difference between URI style and plain paths (-> TortoiseSVN user :P). Thanks for that, I'll try tomorrow if I can extract the relevant information like this.
Tried it out now, both of my requirements can be met with pysvn.Client().log("file:///path/to/repo", discover_changed_paths = True). Thanks for your help!
0

I think you want something like py-svn.

2 Comments

I have already looked into its programmer's reference and tested it, but it doesn't seem to be able to read repositories (only WCs). Correct me if I'm wrong.
@AndiDog: You are wrong. I have updated my answer to give a hint.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.