我的独立博客——不沉之月

SVN on Windows实现文件名严格区分大小写

    Windows系统下文件名是不区分大小写的,但SVN里却是区分大小写的,在Windows里Commit文件,可能会造成版本库里有同名,但大小写不同的两个文件。
    解决方法是添加pre-commit脚本。如下引用是Windows下添加pre-commit脚本的方法,注意文中提到的check-case-insensitive.py已经过时,采用case-insensitive.py获取更好性能。

2009-04-30 Update:

http://www.visualsvn.com/support/topic/00019/

这里讲述了visualsvn server 内置hook的使用方法

实际上,visualsvn server有在windows的系统变量,所以以下语句对不同安装目录的visualsvn server有效

"%VISUALSVN_SERVER%\bin\VisualSVNServerHooks.exe" case-insensitive -t%2 %1


Get these files:

Then:

  • Install Subversion 1.2.3
  • Install Python 2.3.5
  • Unzip svn-win32-1.2.3_py.zip
  • Copy the unzipped directory svn-win32-1.2.3 to inside directory C:\Python23\Lib\site-packages\
  • Copy all DLLS from C:\Program Files\Subversion\bin\*.dll to C:\Python23\Lib\site-packages\svn-win32-1.2.3\python\libsvn\
  • Copy the file check-case-insensitive.py to directory c:\svnrepo\hooks\
  • Edit definition of SVNLIB_DIR in file check-case-insensitive.py to
    SVNLIB_DIR = r"C:/Python23/Lib/site-packages/svn-win32-1.2.3/python/"
  • Add/Create the file c:\svnrepo\hooks\pre-commit.bat containing these lines:
    c:\python23\python c:\svnrepo\hooks\check-case-insensitive.py %1 %2
        if errorlevel 1 goto :ERROR
        exit 0
        :ERROR
        echo Error found in commit 1>&2
        exit 1
        

Test by checking out a repo to two different directories

Create, add, and commit a file with an UPPERCASE name in first directory

Create, add, and commit a file with a lowercase name in second directory

The second commit will fail with this message:

Adding         sales\sale1.cpp
Transmitting file data .svn: Commit failed (details follow):
svn: 'pre-commit' hook failed with error output:
Case conflict: svnrepo/acme/trunk/sales/sale1.cpp
Error found in commit

Delete the UPPERCASE file with an "svn rm svn://.." command

The second commit can now go through

Thanks to xnooby for working this out and posting these instructions to the mailing list.

posted on 2009-01-31 17:57  vls  阅读(9362)  评论(0编辑  收藏  举报