pysvn

Get working copy root path using pysvn


When I run the SVN command 'svn info path', the SVN command line client (v1.8.4) spits out (among other things) a 'Working Copy Root Path'.

How would I get this same information using pysvn? Seems like it should be available using the either pysvn.Client.info() or pysvn.Client.info2(), but it doesn't seem to me that it's there.


Solution

  • Unfortunately it seems like, even nine years later, there's still no way to directly get the wc-root via pysvn. The only way I've found to do it is with the svn command line client. Something like:

    def get_working_copy_root(path="."):
        return subprocess.check_output(["svn", "info", "--show-item", "wc-root", path]).decode("utf-8").strip()