On Sat, Jun 23, 2018 at 10:08:31PM -0400, Jean-François Doyon wrote:
> 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)
Try this:
>>> 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)
> 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
Received on 2018-06-24 08:40:41 CEST