[英]SVN checkout ignore folder
我可以忽略 svn 結帳上的文件夾嗎? 我需要在我的構建服務器結帳時忽略 DOCs 文件夾。
編輯:忽略外部不是一個選項。 我有一些我需要的外部設備。
您不能直接忽略結賬時的文件夾,但您可以在svn 1.5中使用稀疏結賬。 例如:
$ svn co http://subversion/project/trunk my_checkout --depth immediates
這會將項目主干中的文件和目錄檢查到“my_checkout”,但不會遞歸到這些目錄中。 例如:
$ cd my_checkout && ls
bar/ baz foo xyzzy/
然后得到'bar'的內容:
$ cd bar && svn update --set-depth infinity
是的,您可以使用SVN 1.6。 您需要先進行結帳,然后標記要排除的文件夾,然后刪除不需要的文件夾。
svn checkout http://www.example.com/project
cd project
svn update --set-depth=exclude docs
rm -fr docs
從現在開始,對工作副本的任何更新都不會重新填充docs文件夾。
請參閱http://blogs.collab.net/subversion/2009/03/sparse-directories-now-with-exclusion/和http://subversion.apache.org/docs/release-notes/1.6.html#sparse-目錄排除更多詳細信息。
湯姆
對於1.5之前的版本,我發現如果您只簽出最頂層的文件夾然后有選擇地更新,那么從那時開始更新只會影響你簽出的內容。 IE瀏覽器。
svn co -N foo
cd foo
svn up -N bar
svn up
-N標志使操作不是遞歸的。 以上內容不會檢查foo級別的任何其他內容,例如。 說lala
有一個文件夾,最后svn up不會檢查出那個文件夾,但是會更新bar
。
但是稍后你可以svn up lala
,然后把它加到收銀台。
據推測,這也適用於1.5。
這是在TortoiseSVN客戶端1.7.1(也可能在某些舊版本中可用):
SVN簽出 - >選擇存儲庫的URL
點擊“Checkout Items”(Checkout Depth)並選擇僅需要的文件夾!
是的, Subversion 1.5有一個名為Sparse checkouts的功能,它可以做到這一點。
您可以將docs文件夾放在外部存儲庫中,然后使用svn checkout --ignore-externals
。
我發現這個問題正在尋找一種方法來檢查WebKit源,同時排除回歸測試。 我最終得到了以下內容:
svn checkout http://svn.webkit.org/repository/webkit/trunk WebKit \
--depth immediates
cd WebKit
find . \
-maxdepth 1 -type d \
-not -name '.*' \
-not -name '*Tests' \
-not -name 'Examples' \
-not -name 'Websites' \
| (while read SUBDIR; do svn update --set-depth infinity "$SUBDIR"; done)
請注意,您可以根據需要更改排除項,但。*建議跳過工作目錄(已經是最新的)和所有.svn目錄。
我最近解決了同樣的任務。 想法是獲取存儲庫下的文件夾/文件的直接列表,排除您需要的條目,然后檢查剩余的文件夾並更新即時文件(如果有的話)。 這是解決方案:
# Path to the svn repository to be checked out
rpath=https://svn-repo.company.com/sw/trunk/ && \
# This files are to be excluded (folders are ending with '/')
# this is a regex pattern with OR ('|') between enties to be excluded
excludep='docs_folder/tests_folder/|huge_folder/|file1|file2' && \
# Get list of the files/folders right under the repository path
filtered=`svn ls $rpath | egrep -v $excludep` && \
# Get list of files out of filtered - they need to be 'uped'
files=`echo $filtered | sed 's| |\n|g' | egrep '^.*[^/]$'` && \
# Get list of folders out of filtered - they need to be 'coed'
folders=`echo $filtered | sed 's| |\n|g' | egrep '^.*[/]$'` && \
# Initial nonrecursive checkout of repository - just empty
# to the current (./) working directory
svn co $rpath ./ --depth empty && \
# Update the files
svn up $files &&\
# Check out the all other folders finally.
svn co `echo $folders | sed "s|\<|$rpath|g"`
切換到源工作目錄。 復制命令。 糊。 更改相應的URL並排除模式。 運行命令。
謝謝,
不,忽略僅用於添加文件。
您可以使用稀疏檢出(如果使用svn 1.5)
正如其他一些人所提到的,您可以在結賬時使用svn:externals屬性,然后使用--ignore-externals選項。 有一點需要注意,但是,是的svn:的外部不一定需要參考其他資料庫。 它可以是同一個倉庫中某些其他文件夾的引用。
我見過的最好的方法是檢查零深度版本,然后將 go 放入您需要更改和更新深度的目錄中。
檢出零深度文件夾
$ svn co svn://subversion/project/my_project_dir --depth immediates
然后進入工作文件夾並增加深度
$ cd my_project_dir
$ cd working_dir && svn update --set-depth infinity
根據需要更新盡可能多的文件夾!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.