Oops sorry I should have used a raw string. Patch reattached. [[[ Make svn_apply_autoprops.py Windows-compatible.
* contrib/client-side/svn_apply_autoprops.py: Add default Windows Subversion configuration path. (process_autoprop_lines): Use `ON` instead of `*` for boolean properties. (filter_walk): Replace `os.spawnvp()` with `subprocess.call()`. ]]] -- Khairul On Thu, Apr 25, 2024 at 6:18 PM Khairul Azhar Kasmiran <kaza...@gmail.com> wrote: > > Thanks everyone for the comments! > > > * HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config > > I think reading from this registry key should be done in a different > patch (probably not done by me) since it significantly complicates > matters. > > > To make the script compatible with Windows needs to change the reading > > configurations. > > I agree and in fact I've been using the `--config` option which is > definitely not optimal (but only needs to be done once). I've attached > an updated version of the patch that reads from > %APPDATA%\Subversion\config on Windows. > > [[[ > Make svn_apply_autoprops.py Windows-compatible. > > * contrib/client-side/svn_apply_autoprops.py: Add default Windows > Subversion configuration path. > (process_autoprop_lines): Use `ON` instead of `*` for boolean properties. > (filter_walk): Replace `os.spawnvp()` with `subprocess.call()`. > ]]] > > -- Khairul > > On Thu, Apr 25, 2024 at 3:06 PM Branko Čibej <br...@apache.org> wrote: > > > > On 25. 04. 24 00:29, Jun Omae wrote: > > > > Hi, > > > > On Tue, Apr 23, 2024 at 8:42 PM Khairul Azhar Kasmiran > > <kaza...@gmail.com> wrote: > > > > I've reattached the patch as a .txt file. > > > > On 2024/04/23 10:46:41 Khairul Azhar Kasmiran wrote: > > > > Hi everyone! > > > > This is a patch to make `contrib/client-side/svn_apply_autoprops.py` > > Windows-compatible -- I have just found out that `git svn` doesn't > > honor autoprops. > > > > In POSIX environment, Subversion configurations are loaded from > > ~/.subversion/config file. > > > > 33 # The default path to the Subversion configuration file. > > 34 SVN_CONFIG_FILENAME = os.path.expandvars('$HOME/.subversion/config') > > > > However, the following registry or file is used in Windows. > > > > * HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config > > * %USERPROFILE%\AppData\Roaming\Subversion\config > > > > > > This is actually %APPDATA%\Subversion\config, there's no guarantee that > > %APPDATA% points to the roaming profile. > > > > > > To make the script compatible with Windows needs to change the reading > > configurations. > > > > > > Yes. > > > > -- Brane
Index: contrib/client-side/svn_apply_autoprops.py =================================================================== --- contrib/client-side/svn_apply_autoprops.py (revision 1917278) +++ contrib/client-side/svn_apply_autoprops.py (working copy) @@ -27,11 +27,15 @@ import getopt import fnmatch import os +import platform import re +import subprocess import sys # The default path to the Subversion configuration file. -SVN_CONFIG_FILENAME = os.path.expandvars('$HOME/.subversion/config') +SVN_CONFIG_FILENAME = os.path.expandvars( + r'%APPDATA%\Subversion\config' if platform.system() == 'Windows' + else '$HOME/.subversion/config') # The name of Subversion's private directory in working copies. SVN_WC_ADM_DIR_NAME = '.svn' @@ -111,7 +115,7 @@ def process_autoprop_lines(lines): prop_value = prop_value.strip() except ValueError: prop_name = prop - prop_value = '*' + prop_value = 'ON' if len(prop_name): props_list += [(prop_name, prop_value)] @@ -144,7 +148,7 @@ def filter_walk(autoprop_lines, dirname, filenames for f in matching_filenames: command += ["%s/%s" % (dirname, f)] - status = os.spawnvp(os.P_WAIT, 'svn', command) + status = subprocess.call(command) if status: print('Command %s failed with exit status %s' \ % (command, status))