繁体   English   中英

SVN 结帐忽略文件夹

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM