• [转] windows下Svn服务器之必须提交修改注释篇


    1. 强制添加注释信息

    找到Respositories目录下对应项目里的hooks目录下建立pre-commit.bat文件,复制如下内容: 

    @echo off
    set SVNLOOK="C:Program FilesVisualSVNinsvnlook.exe"
    setlocal
    set REPOS=%1
    set TXN=%2
    rem check that logmessage contains at least 10 characters
    %SVNLOOK% log "%REPOS%" -t "%TXN%" | findstr ".........." > nul
    if %errorlevel% gtr 0 goto err
    exit 0
    :err
    echo Empty log message not allowed. Commit aborted! 1>&2
    exit 1
    

      

    2. 允许用户修改注释信息
    找到Respositories目录下对应项目里的hooks目录下建立pre-revpos-change.bat,复制如下内容:
    @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 /b 1
    

      

  • 相关阅读:
    alpha测试和beta测试的区别
    当设计师遭遇HTML5
    软件开发项目中如何进行风险管理
    程序员应知——关注细节
    与Janet关于敏捷测试若干问题的Q&A
    软件开发中的哲学——世界的本原是物质(一)
    软件开发中的哲学——写在前面
    软硬兼施让客户满意
    浅谈DBA的角色以及与业务的关系
    连接access时的REGDB_E_CLASSNOTREG(0x80040154)错误
  • 原文地址:https://www.cnblogs.com/asyuras/p/3242452.html
Copyright © 2020-2023  润新知