2011-08-15 41 views
2

我試圖通過git-svn簽出一個SVN回購協議,並有問題讓git與trunk/branches/tags目錄發揮很好。git-svn結帳項目不工作與-s

這工作得很好:

git svn clone https://svn-repo-base/projects/path/to/my/project/trunk 

但是當我嘗試:

git svn clone -s --no-minimize-url https://svn-repo-base/projects/path/to/my/project/ 

我只是得到沒有克隆文件的空目錄。 (--no-minimize-url是因爲git試圖在沒有它的https://svn-repo-base/上進行結賬)

任何想法我在這裏做錯了嗎?

回答

0
  1. 使用git svn init和隨後git svn fetch而非git svn clone。這種方法比git svn clone
  2. 要穩定得多。如果你的Subversion版本庫遵循標準的顛覆/trunk/branches/tags方案中,-s開關應該只是工作。 Ommit在你的URL中的拖尾/trunk/

    git svn init -s https://svn-repo-base/projects/path/to/my/project project.git 
    git svn fetch 
    
  3. 對我來說svn fetch中止經常而是再次回顧它無縫地繼續。因此,我甚至寫了一整個腳本,它使用Windows批處理文件更新/重新提交所有Git-on-SVN存儲庫。我用這個git-fetch-all每天獲取所有的Git庫中的所有最新的SVN提交(在名爲git的目錄):

    @Echo Off 
    
    IF "%1"=="" GOTO noparams 
    
    IF "%1"=="fetch" GOTO fetch 
    
    goto end 
    
    :fetch 
    IF NOT exist .git\svn\refs\remotes goto nosvnwc 
    git svn fetch 
    if ERRORLEVEL 1 goto fetch 
    git svn rebase -l 
    goto end 
    
    :nosvnwc 
    ECHO --- Directory seems not to be a SVN bound Git Repository. Doing plain fetch 
    git fetch --all 
    goto end 
    
    :noparams 
    FOR /d %%f IN (.\*.git) DO (
    cd %%f 
    ECHO --- Fetching %%f SVN Commits ------------------------------------------ 
    call ..\%0 fetch 
    ECHO --- Calling 'git gc --auto' in %%f 
    git gc --auto 
    cd .. 
    ECHO --- Leaving %%f 
    ECHO. 
    ECHO. 
    ) 
    
    :end 
    ECHO Update finished.