Discussion:
svn_client_get_wc_root() issues (Python)
Jean-François Doyon
2018-06-24 02:08:31 UTC
Permalink
Hi all,

Apparently this function should return the local abs path to the root of
the WC, given a path to a file/dir within said WC.

It however seems to only work on the root itself, anything below raises an
error.

Note the first example below works ('content' the root of the WC), and the
second, for a file within it ('index.html'), fails!

Yes, the WC is clean and in good state, .svn is there, things are
committed, TortoiseSVN shows the illustrated icons, etc.

libsvn and bindings are directly from VisualSVN, on Windows obviously.

Do I need to setup my context further? Or is this a bug? (Did not see
anything in the issue tracker)

Details below ... thanks!
J.F.

Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
from svn import client
ctx = client.svn_client_create_context2(None)
wcrootpath =
client.svn_client_get_wc_root('D:\\Users\\JF\\Documents\\content', ctx)
wcrootpath
'D:\\Users\\JF\\Documents\\content'
wcrootpath =
client.svn_client_get_wc_root('D:\\Users\\JF\\Documents\\content\\index.html',
ctx)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\VisualSVN Server\PythonPackages\libsvn\client.py",
line 2907, in svn_client_get_wc_root
return _client.svn_client_get_wc_root(*args)
svn.core.SubversionException: 155007 -
'D:\Users\JF\Documents\content\index.html' is not a working copy

svn --version:
svn, version 1.10.0 (r1827917)
compiled May 23 2018, 19:08:39 on x86_64-microsoft-windows6.1.7601
Stefan Sperling
2018-06-24 06:40:07 UTC
Permalink
Post by Jean-François Doyon
Hi all,
Apparently this function should return the local abs path to the root of
the WC, given a path to a file/dir within said WC.
It however seems to only work on the root itself, anything below raises an
error.
Note the first example below works ('content' the root of the WC), and the
second, for a file within it ('index.html'), fails!
Yes, the WC is clean and in good state, .svn is there, things are
committed, TortoiseSVN shows the illustrated icons, etc.
libsvn and bindings are directly from VisualSVN, on Windows obviously.
Do I need to setup my context further? Or is this a bug? (Did not see
anything in the issue tracker)
from svn import core, client
path = core.svn_dirent_internal_style('D:\\Users\\JF\\Documents\\content')
ctx = client.svn_client_create_context2(None)
wcrootpath = client.svn_client_get_wc_root(path, ctx)
Details below ... thanks!
J.F.
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
from svn import client
ctx = client.svn_client_create_context2(None)
wcrootpath =
client.svn_client_get_wc_root('D:\\Users\\JF\\Documents\\content', ctx)
wcrootpath
'D:\\Users\\JF\\Documents\\content'
wcrootpath =
client.svn_client_get_wc_root('D:\\Users\\JF\\Documents\\content\\index.html',
ctx)
File "<stdin>", line 1, in <module>
File "C:\Program Files\VisualSVN Server\PythonPackages\libsvn\client.py",
line 2907, in svn_client_get_wc_root
return _client.svn_client_get_wc_root(*args)
svn.core.SubversionException: 155007 -
'D:\Users\JF\Documents\content\index.html' is not a working copy
svn, version 1.10.0 (r1827917)
compiled May 23 2018, 19:08:39 on x86_64-microsoft-windows6.1.7601
Stefan Sperling
2018-06-24 06:44:08 UTC
Permalink
Post by Jean-François Doyon
Hi all,
Apparently this function should return the local abs path to the root of
the WC, given a path to a file/dir within said WC.
It however seems to only work on the root itself, anything below raises an
error.
Note the first example below works ('content' the root of the WC), and the
second, for a file within it ('index.html'), fails!
Yes, the WC is clean and in good state, .svn is there, things are
committed, TortoiseSVN shows the illustrated icons, etc.
libsvn and bindings are directly from VisualSVN, on Windows obviously.
Do I need to setup my context further? Or is this a bug? (Did not see
anything in the issue tracker)
from svn import core, client
path = core.svn_dirent_internal_style('D:\\Users\\JF\\Documents\\content')
ctx = client.svn_client_create_context2(None)
wcrootpath = client.svn_client_get_wc_root(path, ctx)
Forgot to mention:

If your script needs wcrootpath as a windows-style path,
Post by Jean-François Doyon
wcrootpath = core.svn_dirent_local_style(wcrootpath)
Jean-François Doyon
2018-06-24 12:12:30 UTC
Permalink
Ah yes, one should use canonical internal style paths, of course ... thank
you!
Post by Jean-François Doyon
Post by Jean-François Doyon
Hi all,
Apparently this function should return the local abs path to the root
of
Post by Jean-François Doyon
the WC, given a path to a file/dir within said WC.
It however seems to only work on the root itself, anything below
raises an
Post by Jean-François Doyon
error.
Note the first example below works ('content' the root of the WC), and
the
Post by Jean-François Doyon
second, for a file within it ('index.html'), fails!
Yes, the WC is clean and in good state, .svn is there, things are
committed, TortoiseSVN shows the illustrated icons, etc.
libsvn and bindings are directly from VisualSVN, on Windows obviously.
Do I need to setup my context further? Or is this a bug? (Did not see
anything in the issue tracker)
from svn import core, client
path =
core.svn_dirent_internal_style('D:\\Users\\JF\\Documents\\content')
Post by Jean-François Doyon
ctx = client.svn_client_create_context2(None)
wcrootpath = client.svn_client_get_wc_root(path, ctx)
If your script needs wcrootpath as a windows-style path,
Post by Jean-François Doyon
wcrootpath = core.svn_dirent_local_style(wcrootpath)
Loading...