2011-01-24 23 views
8

當我右鍵單擊我的本地工作副本並選擇顯示日誌時。 TortoiseSVN向我顯示爲該版本更改的每個文件的完整路徑。 從tortoiseSVN界面我想要做的是以下。導出僅顛覆維護目錄結構的已更改文件

當我右鍵單擊修訂號並選擇導出。我希望它將文件導出,同時保留它們的目錄。

這可能嗎?換句話說,我只想將我在上次提交中更改的文件導出到硬盤上的文件夾中(這不是我的工作副本),但我不希望它們全部混在一起父目錄。我希望他們被複制,包括他們的相對路徑。

回答

0

不,這是不可能的。您可以導出修訂版本中的整個存儲庫,也可以導出平鋪路徑的已更改文件。

9

我意識到這是一個很古老的問題,但回答這裏將幫助人們在谷歌搜索像我這樣的:

svn status | grep '^[ADMR]' | cut -b 8- | xargs -I '{}' cp --parents {} /temporary/destination/dir 
+0

+1,因爲它的工作非常適合我,雖然,嚴格來說,它並沒有因爲它不回答原來的問題不能在windows下工作 – martin 2012-10-08 15:23:14

+0

它能在Windows下安裝[Cygwin](http://cygwin.com)嗎? – 2014-04-23 07:53:55

1

BASH

比方說,你有一個dev的服務器,使用SVN,但你的生產服務器沒有SVN。 因此你開發和SVN導出,並將導出的網站上傳到生產環境。

現在您進行了更改,但您不希望rsync /上傳整個導出 - 只是更改。

在開發服務器:

(假設你簽出開發站點與svn checkout https://svn.server.com/web/sitename/trunk /path/to/sitename和假設開發站點文件是在HEAD)

cd /path/to/sitename/ 
zip /path/to/diff.zip $(svn diff --summarize -r 123:HEAD https://svn.server.com/web/sitename/trunk | awk '{ print $2 }' | sed -e 's{https://svn.server.com/web/sitename/trunk/{{') 

這將創建與改變的文件的ZIP文件[S] - 在完整的目錄結構中 - 從修訂版123:HEAD。

如果由於某種原因你不想頭,然後:

cd /path/to/sitename/ 
svn up -r:124 
zip /path/to/diff.zip $(svn diff --summarize -r 123:124 https://svn.server.com/web/sitename/trunk | awk '{ print $2 }' | sed -e 's{https://svn.server.com/web/sitename/trunk/{{') 
svn up 

(此設置DEV所需的修訂,抓住文件[S],然後UPS回HEAD)

1

由於這是谷歌首次使用SVN導出已更改文件的結果之一,我爲Windows製作了批量版本。不是很複雜,因爲我很少需要批量做某件事,但它應該完成這項工作。 您需要在您的路徑中使用svn.exe才能正常工作。還要注意在目錄變量中包含尾部反斜線。

@echo off 
set maindir=C:\path\to\project\root\ 
set exportdir=C:\path\to\project\export\ 

:: Delete the export dir and create it again to get rid of the old files 
rd %exportdir% /S /Q 
md %exportdir% 

:: Go to the svn directory 
cd %maindir% 

:: Go through all "svn status" results 
FOR /f "tokens=*" %%G IN ('svn status') DO (call :copyfile "%%G") 
GOTO :eof 

:: Copy the files to the export directory 
:copyfile 
    :: We can't directly substr the file name, so we need to buffer it 
    set line=%1 

    :: substr the correct file name (character 9 to one before the end of the string) 
    set filepath=%line:~9,-1% 

    :: Copy the file (the asterisk means that it won't ask if directory or file) 
    xcopy %maindir%%filepath% %exportdir%%filepath%* /H 
    GOTO :eof 

Linux命令是有點短。要麼使用一個在喬的回答看出,或這甚至更短的一個(發現here):

svn status | cut -c9-99999 | cpio -pvdmu /path/to/export