• 在Windows下配置svn服务端钩子程序(部分)


    需求一,svn提交时必须填写log日志的需求,如何进行配置呢?请看下面。

    需要在版本库目录下找到hooks文件夹,我的版本库是dxoffice,所以是这个目录,你要找自己的目录

    然后进入,创建一个pre-commit.bat文件,提交之前要做的一个hooks文件,编辑,将以下内容拷贝到文件中并进行保存。

    @echo off  
    ::     
    :: Stops commits that have empty log messages.  
    ::  
      
    @echo off  
      
    set svnlook="D:/Program Files/VisualSVN Server/bin/svnlook.exe" //此处是你的svnanzhu  
    setlocal  
      
    rem Subversion sends through the path to the repository and transaction id  
    set REPOS=%1  
    set TXN=%2  
      
    rem check for an empty log message  
    %svnlook% log %REPOS% -t %TXN% | findstr . > nul  
    if %errorlevel% gtr 0 (goto err) else exit 0  
      
    :err  
    echo. 1>&2  
    echo Your commit has been blocked because you didn't give any log message 1>&2  //此处是返回给客户端的错误信息  
    echo Please write a log message describing the purpose of your changes and 1>&2  
    echo then try committing again. -- Thank you 1>&2  
    exit 1  

    如果您有最少提交多少字的需求,只需在%svnlook% log %REPOS% -t %TXN% | findstr . > nul这行代码中找到findstr .在这里有一个 点表示最少输入1个字符,如果是10个点代表最少输入10个字符,以此类推。保存之后,不用重启服务器就可以进行尝试

    需求二:提交svn后,需要同步web目录

    方法同上面差不多,创建post-commit.bat文件,然后将下面代码拷贝到里面

    @echo off  
    SET REPOS=%1  
    SET REV=%2  
    SET DIR=%REPOS%/hooks  
    SET PATH=%PATH%;  
    SET WORKING_COPY=E:/svn_test  //此处是你的项目路径,此路径必须是一个svn的路径,这意味着你已经checkout出了源码  
    svn update %WORKING_COPY% --username name --password password    //输入svn用户名密码  

    还有一个注意问题——Visual SVN Server的权限,否则可能会出现下列错误:
    post-commit hook failed (exit code 1) with output:
    svn: E155004: Working copy 'D:wwwTest' locked
    svn: E200031: sqlite: attempt to write a readonly database
    svn: E200031: sqlite: attempt to write a readonly database
    svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
    原因是Visual SVN Server服务的执行权限不够,不能对指定目录做读写操作。解决办法,修改Visual SVN Server 
         简单操作 win+R  运行 services.msc 找到visual svn server 服务 右键属性 先停止服务之后,再设置登陆,设置桌面交互或者管理员权限

    注:http://blog.csdn.net/ght521/article/details/52355778

  • 相关阅读:
    DockerAn error occurred ...WSL2
    Vue报错 Node Sass version 7.0.1 is incompatible with ^4.0.0.
    WPF个性选择框
    WPF渐变按钮
    VS报错无法解析位于global.json 中指定的 .NET SDK 版本
    WPF TextBox与PasswordBox个性样式
    Vue报错Node Sass does not yet support your current environment: Windows 64bit with Unsupported runtime
    DockerCancellation token triggered before we finished reading from the stream.
    VS离线安装Nuget包
    Cv2识别无原图滑动验证码
  • 原文地址:https://www.cnblogs.com/liaojie970/p/8611732.html
Copyright © 2020-2023  润新知