svn同mantis的整合實戰(網上資料淩亂,自己做攻略)

來源:互聯網
上載者:User

1.準備資源:mantis1.26或更高;phpstudy2010(apache,php,mysql的Integration Environment);svn伺服器及用戶端;

2.建立好phpstudy的運行環境,phpinfo.php測試通過。在php.ini的設定檔中開啟相關擴充(預設的已經足夠了)。

3.mantis安裝通過,並添加同svn相同的使用者。密碼不同不妨礙。

4.svn用戶端,在該項目屬性中添加

bugtraq:label = issue
bugtraq:url = http://192.168.0.8/mantis/view.php?id=%BUGID%
bugtraq:message = issue %BUGID%
bugtraq:warnifnoissue = true

根據自己的ip自己設定。

 

5.svn伺服器對應項目的hooks裡添加2個bat檔案

內容如下:

(1)post-commit.bat

 

REM Post-commit hook for MantisBT integration
 
rem REPOS svn版本庫的路徑
rem REV 版本資訊
 
SET REPOS=%1
SET REV=%2
SET DETAILS_FILE=I:\Repositories\mantis\log\svnfile_%REV%
SET LOG_FILE=I:\Repositories\mantis\log\svnfile_%REV%_Log
#set APR_ICONV_PATH=C:\Program Files\Subversion\iconv
set PHPRC=C:\phpStudy\Apache2
set path=%path%;C:\phpStudy\php5;C:\phpStudy\php5\ext;C:\Program Files\VisualSVN Server\bin;
echo ****** Source code change ******>>%DETAILS_FILE%
 
rem 進入svnlook目錄
cd C:\Program Files\VisualSVN Server\bin
echo SVN 修改人: >>%DETAILS_FILE%
svnlook author -r %REV% %REPOS%>>%DETAILS_FILE%

echo SVN 提交注釋: >>%DETAILS_FILE%
svnlook log -r %REV% %REPOS%>>%DETAILS_FILE%

echo SVN 修改明細: >>%DETAILS_FILE%
svnlook diff -r %REV% %REPOS%>>%DETAILS_FILE%

echo SVN 版本:  >>%DETAILS_FILE%
echo %REV%>>%DETAILS_FILE%

echo SVN 修改日期: >>%DETAILS_FILE%
svnlook date -r %REV% %REPOS%>>%DETAILS_FILE%

rem php.exe C:\www\mantis\core\checkin_svn.php 資訊檔記錄檔
cd C:\phpStudy\php5
php.exe C:\www\mantis\scripts\checkin.php <%DETAILS_FILE%>%LOG_FILE%
 
del %DETAILS_FILE%
del %LOG_FILE%

 

(2) pre-commit.bat

 

REM pre-commit.bat hook for MantisBT integration
SET REPOS=%1
SET REV=%2
SET DETAILS_FILE=I:\Repositories\mantis\log\svnfile_%REV%
SET LOG_FILE=I:\Repositories\mantis\log\svnfile_%REV%_Log
#set APR_ICONV_PATH=D:\TZSvn\Tool\SvnServer\iconv
set PHPRC=C:\phpStudy\Apache2
set path=%path%;C:\phpStudy\php5C:\Program Files\VisualSVN Server\bin;
 
rem 把注釋資訊寫入到 DETAILS_FILE
svnlook log "%REPOS%" -t "%TXN%"  >>%DETAILS_FILE%
 
rem 執行checkin_svn_pre_commit.php 進行校正缺陷單號 是否在缺陷系統中存在,如果不存在,返回輸出資訊到 log_file中
php.exe C:\www\mantis\core\checkin_svn_pre_commit.php <%DETAILS_FILE%>%LOG_FILE%
 
rem 校正log_file中是否有內容,如果有內容,轉入到出錯提示
FOR /F "tokens=1,2* delims= " %%i in (%LOG_FILE%) do goto err
 
del %DETAILS_FILE%
del %LOG_FILE%
exit 0
 
:err
echo 缺陷單不存在,請正確填寫缺陷單號,提交終止! 1>&2
del %DETAILS_FILE%
del %LOG_FILE%
exit 1

6.mantis預設是英文,可以更改為中文顯示

開啟檔案:<mantisbt>\config_defaults_inc.php,
尋找$g_default_language
修改:$g_default_language = 'english';
為:$g_default_language = 'chinese_simplified';
儲存,重新整理頁面即可。

 

7.mantis 管理員賬戶 更改使用者的密碼可以採用這個方法

 

mantis管理員重設使用者密碼時,使用者密碼更改串連會發往使用者的信箱中。但如果此時使用者信箱無法使用,則使用者將無法登陸mantis,影響工作。mantis沒有提供管理員手工設定使用者口令的功能,但查閱資料,可以為mantis增加該項功能,使mantisg管理員管理起來更方便。具體步驟如下:

1. 修改檔案 manage_user_edit_page.php

1) 找到該行:"<!-- Email -->

2) 粘貼下面代碼:

<!-- Password -->
<tr <?php echo helper_alternate_class( 1 ) ?>>
<td class="category" width="30%">
<?php echo "Password (change only)" ?>:
</td>
<td width="70%">
<input type="text" size="16" maxlength="100" name="password" value="" />
</td>
</tr>

2. 修改檔案 manage_user_update.php

1) 找到該行: $f_user_id = gpc_get_int( 'user_id' );

2) 在該行下粘貼下面行:

$f_pass = gpc_get_string('password');

3) 找到該行: $result = db_query( $query ); 有的版本是:$result = db_query_bound( $query, $query_params );

4) 在該行上面粘貼下面行:
//Reset the password if specified.
if ($f_pass) user_set_password($f_user_id, $f_pass);

 

以上就是我實戰經過,順利通過測試。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.