有關 SVN Repository 的分割

前幾天發現公司的 SVN Repository 佔用的磁碟空間已經超過8G了, 這樣對未來的備份及維護來說不太好, 再加上現行是把文件跟程式碼都餵到同一個repository, 所以就決定要動手進行分割.

查了一下 SVN Book 中有關 Repository Maintenance 的章節, 發現可以利用 svndumpfilter來達成分割的工作. 基本上只有一個步驟:


svnadmin dump <source path> | 
 svndumpfilter include <include prefix> | 
 svnadmin load <dest path>

事實上 svndumpfilter 還有一些參數, 可以利用 svndumpfilter help 來取得說明, 例如:


>svndumpfilter help include
include: 自傾印串流移除未包含指定字首的節點.
usage: svndumpfilter include PATH_PREFIX...

有效選項:
  --drop-empty-revs        : 移除因過濾而產生的空修訂版.
  --renumber-revs          : 過濾後重編餘下的修訂版.
  --preserve-revprops      : 不過濾修訂版性質.
  --quiet                  : 不顯示過濾的統計資料.

在我的例子裡沒有用到 –drop-empty-revs 及 –renumber-revs, 這樣在切割後, 已經 checkout 出來的 working copy 可以直接使用 relocate 指令轉到新的 URL, 不需要重新 checkout. (前題是建立新的 repository 後就直接 load, 如果有執行其它動作的話, 兩個 repository 會被視為是不同的 repository, 就無法 relocate 了)

0 Responses to “有關 SVN Repository 的分割”


  1. No Comments

Leave a Reply