差異處
這裏顯示兩個版本的差異處。
兩邊的前次修訂版 前次修改 下次修改 | 前次修改 | ||
tech:svnmantis [2007/12/28 06:43] – jonathan | tech:svnmantis [2018/04/16 05:40] (目前版本) – [參考資料] Jonathan Tsai | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== Subversion 與 Mantis 整合作法 ====== | ||
+ | |||
+ | ===== 目標 ===== | ||
+ | 當 Mantis 有張貼一個新的 Issue 時, 與這個 Issue 相關的 Subversion 更動紀錄可以自動回寫至 Mantis 這個 Issue 內的 Bug 筆記內. | ||
+ | |||
+ | ===== 相關環境 ===== | ||
+ | * Mantis 與 Subversion 都安裝在相同的主機上 | ||
+ | * 作業系統為 CentOS release 6.9 x86_64 | ||
+ | * Mantis 版本為 2.8.0 安裝在 / | ||
+ | * Subversion 版本為 1.6.11-15 | ||
+ | * SVN 資料檔案路徑 / | ||
+ | |||
+ | < | ||
+ | * 因為 Mantis 2.x 無法在 core 目錄底下找到 checkin.php | ||
+ | * 需要改用 plugin - https:// | ||
+ | * 如果要參考之前的紀錄, | ||
+ | </ | ||
+ | |||
+ | ===== 安裝 plugin - source-integration ===== | ||
+ | * 下載最新版 plugin <code sh> | ||
+ | cd / | ||
+ | wget https:// | ||
+ | unzip master.zip | ||
+ | rm master.zip | ||
+ | cd source-integration-master/ | ||
+ | cp -a Source .. | ||
+ | cp -a SourceSVN .. | ||
+ | </ | ||
+ | |||
+ | ===== 設定程序 ===== | ||
+ | ==== Mantis 管理介面設定 ==== | ||
+ | * 至 Mantis 管理-> | ||
+ | * Source Control Integration 2.1.0 | ||
+ | * Source Subversion Integration 2.1.0 | ||
+ | * 在 已安裝的套件 點 Source Control Integration 2.1.0 進行設定 | ||
+ | * 因為我習慣在 svn 說明內打 mantis#123 這樣的方式來表示對 #123 的問題進行更新, | ||
+ | * Bug Link Regex Pass 1 : / | ||
+ | * Bug Fixed Regex Pass 1 : / | ||
+ | * 透過 <code sh> | ||
+ | * 如果是自發憑證, | ||
+ | * 在左邊的選項會多出 Repositories ++看畫面|{{: | ||
+ | * 建立一個對應 SVN 專案 Exp. erptools ++看畫面|{{: | ||
+ | * 建立後輸入 SVN 的 URL Exp. https:// | ||
+ | * 即使在 SVN: Command arguments 有指定 --config-dir 還是需要輸入 SVN Username / SVN Password | ||
+ | |||
+ | ==== 主機端設定 ==== | ||
+ | * 複製 post-commit.tmpl 到 SVN 專案 erptools 的 hooks 目錄內, 並改名為 post-commit <code sh> | ||
+ | cp -a / | ||
+ | chmod a+x / | ||
+ | </ | ||
+ | * 修改 post-commit 內容符合實際環境 <code sh> | ||
+ | vi / | ||
+ | </ | ||
+ | #!/bin/sh | ||
+ | |||
+ | # Copyright (c) 2012 John Reese | ||
+ | # Licensed under the MIT license | ||
+ | |||
+ | REV=" | ||
+ | |||
+ | URL=" | ||
+ | PROJECT=" | ||
+ | API_KEY=" | ||
+ | |||
+ | LOG_FILE=`mktemp / | ||
+ | |||
+ | CURL=/ | ||
+ | |||
+ | ${CURL} -d " | ||
+ | </ | ||
+ | * URL (Mantis 網址) | ||
+ | * API_KEY (在上面透過 openssl rand -hex 12 產生長度 24 的字串) | ||
+ | |||
+ | ===== 測試整合 ===== | ||
+ | |||
+ | * 只要 SubVersion 內的紀錄出現 bug 或 issue 或 mantis #編號 表示整合 Mantis 內的 Issue # Bug 筆記 | ||
+ | * 只要 SubVersion 內的紀錄出現 fixed 或 fixes + bug 或 issue 或 mantis #編號 表示整合 Mantis 內的 Issue # Bug 筆記外, 更會將 issue 狀態改成已修正解決 | ||
+ | * 如果之前在 svn 內的 commit 描述有出現 mantis# 就可以透過以下命令直接測試 Exp. svn# | ||
+ | <code sh> | ||
+ | curl -d " | ||
+ | </ | ||
+ | * 結果如以下畫面: | ||
+ | * 如果成功整合, | ||
+ | * 點進去看 Changesets , 可以看到是否有對應到 Mantis 的 Issue, 沒對應到也可以手動 Attach 上去 \\ {{: | ||
+ | * 點到 Mantis 問題(Issue)頁面, | ||
+ | |||
+ | < | ||
+ | **如果這個步驟沒有正確在 Repositories 的 Changesets 看到, 那就需要到 Server 端 /tmp 查看 log 狀況** | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== 參考資料 ===== | ||
+ | * https:// | ||
+ | * https:// | ||
+ | |||
+ | {{tag> |