EvoTalk

31 五月, 2006

SVN+Mantis Integration

Posted by: asd In: 科技新知| 軟體使用 ()

SVN (Subversion)是一套免費 version control 軟體,按照Trac on Windows Installation,嘗試著整合 svn 和 trac。很麻煩,還要安裝python及一些其它的plugin,裝過一次就不會再想裝第二次。透過google想尋求其它的bug tracking software,Fabrice's weblog列了一些,不過只有平台,沒有language、License等資訊,最好有不同 bug tracking 軟體的比較。Fabrice's weblog所列的See also給了想要的答案Comparison: Web-based Tracker。最後選擇了Mantis,因為Mantis免費且基於php + mysql,容易安裝。

My Mantis設定,其它設定參考別人的blog 博客園

PHP:
  1. // MySQL  設定
  2. $g_hostname = 'localhost';
  3. $g_db_type = 'mysql';
  4. $g_database_name = 'mantis';
  5. $g_db_username = '****';
  6. $g_db_password = '****';
  7.  
  8. // Send Mail  設定
  9. $g_phpMailer_method = 2// PHPMailer 以 SMTP 方式傳送
  10. $g_smtp_host = 'ms1.hinet.net'; // whatever you smtp server is
  11. $g_webmaster_email = 'mymail@gmail.com'; //網站管理者email
  12. $g_stop_on_errors = ON;
  13.  
  14. // Integration with SVN  設定
  15. $g_source_control_notes_view_status = VS_PUBLIC;
  16. $g_source_control_account = 'administrator';
  17. $g_source_control_set_status_to = OFF;
  18. // commit時填寫message的格式
  19. $g_source_control_regexp = "/\bissue [#]{0,1}(\d+)\b/i";
  20.  
  21. //設定 jpgraph 外掛
  22. $g_use_jpgraph = ON;  //打開jpgraph外掛
  23. $g_jpgraph_path = '../mantis/jpgraph/src/'; //jpgraph 外掛的路徑
  24.  
  25. //設定時間
  26. $g_complete_date_format = 'm-d-y H:i'; //時間顯示格式,避免秀出中文亂碼
  27. putenv ('TZ=CCT-8'); //使用台北時間

參考Source Control Integration,編輯YourRepos\hooks\post-commit.bat,加入 

Visual Basic:
  1. SET REPOS=%1
  2.  
  3. SET REV=%2
  4. SET DETAILS_FILE=svnfile_%REV%
  5. SET LOG_FILE=svnfile_%REV%_Log
  6.  
  7. echo ****** Source code change ******>>%DETAILS_FILE%
  8. svnlook log -r %REV% %REPOS%>>%DETAILS_FILE%
  9. echo SVN Revision:%REV%>>%DETAILS_FILE%
  10. svnlook diff -r %REV% %REPOS%>>%DETAILS_FILE%
  11.  
  12. C:\APMXE4\php4\php.exe C:\APMXE4\htdocs\mantis\core\checkin.php <%DETAILS_FILE%>%LOG_FILE%
  13. DEL %DETAILS_FILE%
  14. DEL %LOG_FILE%
  15. rem@echo off
  16. rem
  17. rem
  18. rem if "%1"=="" goto usage
  19. rem if "%2"=="" goto usage
  20. rem
  21. rem
  22. rem svnlook log "%1" -r %2 | php -f d:\www\mantis\core\checkin.php
  23. rem
  24. rem
  25. rem goto theend
  26. rem
  27. rem
  28. rem :usage
  29. rem echo Usage: add_issue_note PATH_TO_REPOSITORY REVISION
  30. rem goto theend
  31. rem
  32. rem
  33. rem :theend

爾後svn commit時,填入的訊息依照格式

issue 數字 message

就會順便寫入mantis,其中數字表示在mantis中第幾個issue(編號),如下圖 issue_id
當我commit時填寫 issue 1 : convert unicode to gb,在mantis就會出現
issue_ci
其結果就是hook bat 的output。
在Mantis依序點選「檢視Bug」->「0000002」->「更新Bug」->「進階更新」
會來到如下圖畫面
update_issue
若「分析」= 「已修正」且「已修正版本」有值,則ChangeLog會work changelog
已修正版本需在建立Project時就要指定欲Release的版本編號

Tags:

Releated Posts



No Responses to "SVN+Mantis Integration"

Comment Form