2009-11-29 26 views
18

我已經重新安裝了我的SVN服務器,路徑從svn://192.168.1.35/DDL2/trunk/DD _...更改爲svn://192.168.1.35/trunk/DD _...。我已經對工作副本進行了一些更改,並希望將其提交到服務器上,因此我需要更改影響工作副本的路徑/網址而不是SVN重新定位或切換?

我試圖用TortoiseSVN的移居功能卻得到了「重新定位只能改變URL中的版本庫部分」,也許我應該使用開關,但我擔心的工作拷貝版本。


svn info svn://192.168.1.35/

Path: 192.168.1.35 
URL: svn://192.168.1.35 
Repository Root: svn://192.168.1.35 
Repository UUID: 259834e4-a888-4201-9858-aaacfe621d8e 
Revision: 58 
Node Kind: directory 
Last Changed Author: rize 
Last Changed Rev: 58 
Last Changed Date: 2009-11-02 18:33:09 +0100 (po, 02 11 2009) 

svn info D:\Programy\Eclipse Workspace\LDD_L2DP

Path: D:\Programy\Eclipse Workspace\LDD_L2DP 
URL: svn://192.168.1.35/DDL2/trunk/DD_L2DP 
Repository Root: svn://192.168.1.35 
Repository UUID: 259834e4-a888-4201-9858-aaacfe621d8e 
Revision: 21 
Node Kind: directory 
Schedule: normal 
Last Changed Author: rize 
Last Changed Rev: 17 
Last Changed Date: 2009-10-21 19:22:41 +0200 (st, 21 10 2009) 

舊結構:

svn://192.168.1.35/DDL2 
svn://192.168.1.35/DDL2/trunk/DD_L2DP 

新結構

svn://192.168.1.35/ 
svn://192.168.1.35/trunk/DD_L2DP 

回答

6

編輯 - 基於以上的輸出,我認爲你需要採取不同的方法。它看起來像原始存儲庫被創建爲/data/repository與存儲庫中名爲DDL2的文件夾。這可以看到你的工作副本的「Repository Root」值。

使用svn switch將無法​​簡單地將存儲庫的根級降低到一個級別。相反,您需要使用svn move來重新組織您新的期望根目錄的回購。這意味着您將繼續從/data/repository服務您的回購,但將DDL2下的所有文件移至頂層。

當然,如果你有本地編輯,移動一堆文件可能會很痛苦。我會完成所有的更改,然後將其作爲單個提交進行。在執行此操作之前,您需要更改svnserve參數。

+0

嗯,我想知道我做錯了什麼。當我右鍵單擊工作副本並選擇TortoiseSVN - > Relocate時,我會看到舊的URL。URL糾正後,我選擇確定並獲得消息: 「看起來你正試圖將工作副本重定位到同一存儲庫內的不同路徑......你真的想重新定位嗎?」,是和......「重新定位只能改變URL的存儲庫部分「,就像我在第一篇文章中寫的那樣。 – RiZe 2009-11-29 20:39:13

+0

您是否碰巧在'svn:// 192.168.1.35 /'創建了一個新的(空的)存儲庫,而不是遷移舊的?另外,在更新之前,舊版本庫是植根於'/ DDL2'還是URL根目錄? – jheddings 2009-11-29 20:51:01

+0

嗯,我想我剛剛複製了存儲庫,但將svnserve參數更改爲: svnserve -d --listen-host = 192.168.1.35 -r/data/repository/DDL2 – RiZe 2009-11-29 20:59:07

20

This question有答案。 Specifically

svn switch --relocate http://svn.example.com/path/to/repository/path/within/repository http://svnnew.example.com/new/repository/path/within/repository 
1
switch (sw): Update the working copy to a different URL. 
usage: 1. switch URL[@PEGREV] [PATH] 
     2. switch --relocate FROM TO [PATH...] 

    1. Update the working copy to mirror a new URL within the repository. 
    This behavior is similar to 'svn update', and is the way to 
    move a working copy to a branch or tag within the same repository. 
    If specified, PEGREV determines in which revision the target is first 
    looked up. 

    If --force is used, unversioned obstructing paths in the working 
    copy do not automatically cause a failure if the switch attempts to 
    add the same path. If the obstructing path is the same type (file 
    or directory) as the corresponding path in the repository it becomes 
    versioned but its contents are left 'as-is' in the working copy. 
    This means that an obstructing directory's unversioned children may 
    also obstruct and become versioned. For files, any content differences 
    between the obstruction and the repository are treated like a local 
    modification to the working copy. All properties from the repository 
    are applied to the obstructing path. 

    Use the --set-depth option to set a new working copy depth on the 
    targets of this operation. Currently, the depth of a working copy 
    directory can only be increased (telescoped more deeply); you cannot 
    make a directory more shallow. 

    2. Rewrite working copy URL metadata to reflect a syntactic change only. 
    This is used when repository's root URL changes (such as a scheme 
    or hostname change) but your working copy still reflects the same 
    directory within the same repository. 
14

如果您打算切換服務器,則使用重新定位。例如,如果您希望工作副本不再以svn://192.168.1.127/DDL2/trunk/DD_L2DP爲參考引用svn://192.168.1.35/DDL2/trunk/DD_L2DP,則需要使用relocate。

如果您想更改工作副本引用的存儲庫上的目錄,則使用開關。我相信這是你想要的。此操作不會影響存儲庫修訂版本號:它只會更新工作副本的URL。

svn move如果您當前使用svn://192.168.1.35/trunk/DDL2DP並且您想創建svn://192.168.1.35/DD_L2DP/trunk,但它尚不存在於您的存儲庫中。