提问的智慧SVN版 - 提问者必读
返回列表 回复 发帖

[求助] Windows下修改注释的hooks文件对中文库名无效

操作系统:windows 2003
SVN和Tsvn都是1.4.6
apache 2.0.59

现在要实现修改历史注释的功能,将pre-revprop-change.bat放入版本库中hooks目录下,内容如下:
@ECHO OFF
set repos=%1
set rev=%2
set user=%3
set propname=%4
set action=%5
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Only allow changes to svn:log. The author, date and other revision
:: properties cannot be changed
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if /I not '%propname%'=='svn:log' goto ERROR_PROPNAME
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Only allow modifications to svn:log (no addition/overwrite or deletion)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if /I not '%action%'=='M' goto ERROR_ACTION
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Make sure that the new svn:log message contains some text.
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
set bIsEmpty=true
for /f "tokens=*" %%g in ('find /V ""') do (
set bIsEmpty=false
)
if '%bIsEmpty%'=='true' goto ERROR_EMPTY
goto :eof
:ERROR_EMPTY
echo Empty svn:log properties are not allowed. >&2
goto ERROR_EXIT
:ERROR_PROPNAME
echo Only changes to svn:log revision properties are allowed. >&2
goto ERROR_EXIT
:ERROR_ACTION
echo Only modifications to svn:log revision properties are allowed. >&2
goto ERROR_EXIT
:ERROR_EXIT
exit 1

经试验后发现只有在库名为英文且没有空格或数字的情况下可以成功修改注释,如果库名中含有中文,或者有数字或空格,就会报错:
DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent. At least one property change failed; repository is unchanged

但是我现在需要在中文名字的库和有空格及英文的库中修改注释的,怎么解决?
有人能帮我解决一下吗?
没有人遇到过吗?
我查了apche下的error.log:
[Wed Apr 15 16:57:26 2009] [error] [client 127.0.0.1] (20014)Error string not specified yet: Can't open file 'D:\\svn\\%E6%B5%8B%E8%AF%95\\format': \xe7\xb3\xbb\xe7\xbb\x9f\xe6\x89\xbe\xe4\xb8\x8d\xe5\x88\xb0\xe6\x8c\x87\xe5\xae\x9a\xe7\x9a\x84\xe8\xb7\xaf\xe5\xbe\x84\xe3\x80\x82  
[Wed Apr 15 16:57:26 2009] [error] [client 127.0.0.1] Could not fetch resource information.  [500, #0]
[Wed Apr 15 16:57:26 2009] [error] [client 127.0.0.1] Could not open the requested SVN filesystem  [500, #720003]
[Wed Apr 15 16:57:26 2009] [error] [client 127.0.0.1] Could not open the requested SVN filesystem  [500, #720003]

就是说如果有中文或者有空格或数字的地方,就自动加上了“%E6%B5%8B%E8%AF%95”这种,导致无法找到正确的路径,也就没法修改log,所以会报错,如果库名是英文的且没有数字和空格,这个hooks文件就可以成功执行。
返回列表
订阅 我用Subversion - SVN中文论坛 邮件列表:iUseSVN@googlegroups.com
电子邮件:
网站重要事项将会在这个列表进行通知,点击这里浏览存于列表中的所有邮件