Hello,

On 2024/09/25 9:17, Vincent Lefevre wrote:

 > Checking the error message might not be future-proof.

Then, check the error code instead.

e.g. with Python bindings:
[[[
import sys
from svn import core, client

def is_path_within_wc(path):
    ret = True
    try:
        client.get_wc_root(core.svn_path_canonicalize(path),
                           client.create_context())
    except core.SubversionException as e:
        if e.apr_err == core.SVN_ERR_WC_NOT_WORKING_COPY:
            ret = False
        else:
            raise(e)
    return ret

if __name__ == '__main__':
    if len(sys.argv) != 2:
        print('Usage: %s <path>' % sys.argv[0])
        exit(2)
    try:
        print('yes' if is_path_within_wc(sys.argv[1]) else 'no')
    except Exception as e:
        print('error:', e)
        exit(1)
]]]

Cheers,
-- 
Yasuhito FUTATSUKI <futat...@yf.bsdclub.org>

Reply via email to