Subversion Repository 目錄名稱規劃

用過版本控制,大概都知道有所謂的trunk、branch、tag。以Subversion來講,官方文件於Repository Layout中,建議使用如下的目錄名稱
  • /trunk
  • /branches
  • /tags

最近,發現同事建立新的版本庫(Repository)時,所用的目錄名稱卻是如下
  • /trunk
  • /branch
  • /tag

提醒他修改之後,也不經好奇當目錄名稱和官方建議的不同時,是否會影響Subversion的運作或判斷?

我覺得會,因為所謂的branch和tag,說穿了只是利用 svn copy在運作(Using Branches)。如果不照官方建議,理應會造成某些判斷和預期的不同。

於是,利用俗稱小烏龜的TortoiseSVN建立分支的功能(Branch/tag)做個小測試。將一個檔案,分別Branch/tag到下面兩個不同的目錄
  • /branch
  • /branches

結果如何呢?請注意下圖用紅色標示處。
果然如原本的猜測,會有不同的結果…
SVN版本圖

最後的結論就是,除非你知道你要做什麼,否則還是照官方建議的規劃方式吧!

其實,在官方文件Recommended Repository Layout中有段敘述稍微有提到,節錄原文如下…
Subversion provides the ultimate flexibility in terms of how you arrange your data. Because it simply versions directories and files, and because it ascribes no particular meaning to any of those objects, you may arrange the data in your repository in any way that you choose. Unfortunately, this flexibility also means that it's easy to find yourself “lost without a roadmap” as you attempt to navigate different Subversion repositories which may carry completely different and unpredictable arrangements of the data within them.

附註:
再看Subversion官方文件時,看到一句話一直看不懂…特別是那個Trunk
It is upon the Trunk that a gentleman works. —Confucius
google後,才知道是孔子所說 - 君子務本

留言