2013-07-30 97 views
2

安裝簡單SVN項目佈局:如何防止合併後在Subversion中丟失提交歷史記錄?

svnadmin create proj-repo 
svn co file://$PWD/proj-repo proj 
cd proj 
mkdir branches trunk tags features 
svn add * 
svn ci -m 'Basic SVN project setup.' 

啓動項目:

cd trunk 
svn add README 
svn ci -m 'Add README' 

實現的功能:

svn cp . ^/features/linux-port 
cd ../../ 
svn co file://$PWD/proj-repo/features/linux-port proj-linux-port 
cd proj-linux-port 
svn ci -m "Implement feature 1." 
svn ci -m "Implement feature 2." 
svn ci -m 'Add last feature.' 

做的工作主要在Dev分支:

svn switch ^/trunk 
svn ci -m "Fix." 

準備新的特點:

svn merge --reintegrate ^/features/linux-port 
svn ci -m 'Integrate features.' 

但現在:

svn log . 

------------------------------------------------------------------------ 
r9 | user | 2013-07-30 18:38:01 +0300 (Tue, 30 Jul 2013) | 1 line 

Integrate features. 
------------------------------------------------------------------------ 
r8 | user | 2013-07-30 18:36:53 +0300 (Tue, 30 Jul 2013) | 1 line 

Fix. 

和:

svn diff -r9 

Index: README 
=================================================================== 
--- README  (revision 8) 
+++ README  (revision 9) 
@@ -1,2 +1,5 @@ 
hello fix 

+feature 1 
+ 
+feature 2 
+ 
+final feature 

Property changes on: . 
___________________________________________________________________ 
Added: svn:mergeinfo 
    Merged /features/linux-port:r2-8 

所以我失去了從/features/linux-port:r2-8每個個體的特徵後,犯。是否可以保存它們而無需切換到HG/Git/Bzr/Fossil?

UPDATE我們通常編寫好的提交消息,解釋編碼決定和把鏈接到BTS。 SVN刪除這些信息,我們非常難過。我們需要使用舊學校Changelog

回答

3

哦,我剛纔仔細閱讀:

svn help log 

    -g [--use-merge-history] : use/display additional information from merge 

如此充滿歷史可用平常SVN工具。

要看到實際的差異用帽子路徑語法:

svn diff -c 4 ^/ 

而且我發現在官方的文檔apropriate部分:

http://svnbook.red-bean.com/en/1.7/svn.branchmerge.advanced.html

The svn blame command also takes the --use-merge-history (-g) option. 
If this option is neglected, somebody looking at a line-by-line annotation 
of file may get the mistaken impression that you were responsible for the lines 
that fixed a certain error 
+1

哈,我剛想說這確實,就是這樣做的。我通常會設置一些東西,比如'alias svnmlog ='svn log -g'',以確保我不會忘記。 ' – Wrikken

相關問題