Using pysvn
to check some SVN working copy properties.
What is the easy way of finding out if a local directory c:\SVN\dir1
is under version control or not?
pysvn.Client.info
will raise pysvn.ClientError
if you pass non working copy directory:
>>> import pysvn
>>> client = pysvn.Client()
>>> client.info('/tmp')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pysvn._pysvn_2_7.ClientError: '/tmp' is not a working copy
You can use that behavior. By catching the exception:
>>> try:
... client.info('/tmp')
... except pysvn.ClientError:
... print('not working copy')
... else:
... print('working copy')
...
not working copy