SVN结帐忽略文件夹

我可以忽略svn结帐的文件夹吗? 我需要忽略我的生成服务器结帐DOC文件夹。

编辑:忽略外部不是一个选项。 我有一些我需要的外部资源。

你不能直接忽略结帐的文件夹,但是你可以在svn 1.5中使用稀疏的签出。 例如:

$ svn co http://subversion/project/trunk my_checkout --depth immediates 

这将从您的项目干线检查文件和目录到“my_checkout”,但不会recursion到这些目录。 例如:

 $ cd my_checkout && ls bar/ baz foo xyzzy/ 

然后获取“酒吧”的内容:

 $ 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 

从现在开始,对工作副本的任何更新都不会重新填充文档文件夹。

请参阅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之前的版本,我发现如果您只签出最上面的文件夹,然后有select性地更新,那么更新只会影响您签出的内容。 IE浏览器。

 svn co -N foo cd foo svn up -N bar svn up 

-N标志使操作不recursion。 以上不会在foo层面检查其他任何东西,例如。 说lala有个文件夹,最后svn起来不会退出那个文件夹,但会更新bar

但是稍后您可以svn up lala ,并将其添加到结帐。

据推测这也适用于1.5。

这是在TortoiseSVN客户端1.7.1(可能在一些旧版本中也可用):

  • SVN签出 – >select存储库的URL

  • 点击“结帐项目”(在结帐深度下),只select需要的文件夹!

你可以把docs文件夹放在一个外部的仓库中,然后使用svn checkout --ignore-externals

是的, Subversion 1.5有一个称为Sparse checkouts的function,可以完成这种事情。

我发现这个问题寻找一种方法来检查WebKit源,同时排除回归testing。 我结束了以下几点:

 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) 

请注意,您可以根据需要更改排除项目,但build议您跳过工作目录(已更新)和所有.svn目录。

我最近解决了同样的任务。 这个想法是获得存储库下的文件夹/文件的直接列表,排除所需的条目,然后查看剩余的文件夹并更新即时文件(如果有的话)。 这是解决scheme:

  # 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:externals并不一定需要引用另一个存储库。 它可以是对同一个仓库中的其他文件夹的引用。