SVN:递归忽略某些目录

发布于 2024-08-17 07:04:48 字数 233 浏览 16 评论 0原文

我不希望任何名为 builddist 的目录进入我的 SVN,无论它在树中有多深。

这可能吗?在 git 中,我只是将

build
dist

.gitignore 放在根目录中,它会递归地忽略。我如何使用 svn 来做到这一点?请不要告诉我在每个父目录上都做一个 propset...

I don't want any directory named build or dist to go into my SVN no matter how deep in the tree it is.

Is this possible? In git I just put

build
dist

in my .gitignore at the root and it recursively ignores. How do I do this with svn? Please don't tell me to do a propset on every parent dir...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

猫瑾少女 2024-08-24 07:04:48

从 subversion 1.8 开始,现在有 svn:global-ignores 属性,其工作方式类似于 svn:ignore 但递归(因此将其设置在顶级目录中)

As of subversion 1.8, there is now the svn:global-ignores property which works like svn:ignore but recursively (so set this on your top-level directory)

旧伤还要旧人安 2024-08-24 07:04:48

svn propset--recursive 作为选项,因此您可以这样做,但有两个缺点:

  1. 您必须签出整个存储库(或至少其中的所有目录) ,并且
  2. 每次添加新目录时都必须记住设置 svn:ignore 属性

svn propset takes --recursive as an option, so you can do this, with two downsides:

  1. you have to check out the entire repository (or at least all directories therein), and
  2. you have to remember to set the svn:ignore property whenever you add a new directory
坐在坟头思考人生 2024-08-24 07:04:48

这对我有用:

 svn propset --recursive svn:ignore *.zip <dir_tree_with_no_zips>

This works for me:

 svn propset --recursive svn:ignore *.zip <dir_tree_with_no_zips>
能否归途做我良人 2024-08-24 07:04:48

添加到您的 ~/.subversion/config 或 /etc/subversion/config 文件:

[miscellany]
global-ignores = build dist

add to your ~/.subversion/config or /etc/subversion/config file:

[miscellany]
global-ignores = build dist
池予 2024-08-24 07:04:48

通过从版本控制中删除目录,可以忽略构建和发行目录。诀窍是使用 --keep-local 选项将目录保留在工作副本中。例如:

svn rm dist --keep-local
svn ci -m'removed build directory from version control'

该目录将不再被 subversion 跟踪,但它仍然存在于您的工作副本中以保存编译器输出等。

干杯,

It is possible to ignore build and dist dirs by removing the directories from version control. The trick is to use the --keep-local option to leave the directory in the working copy. For example:

svn rm dist --keep-local
svn ci -m'removed build directory from version control'

The directory will no longer be tracked by subversion but it will still be there in your working copy to hold compiler output, etc.

cheers,
joe

猫弦 2024-08-24 07:04:48

在 Subversion 1.8 以上,可以为当前存储库设置全局忽略。

svn propset svn:global-ignores build .
svn propset svn:global-ignores dist .

您还可以创建一个名为 .svnignore 的文件夹,并写入条件。

build
dist

记住每行一个条件,设置 build/* 或 dist/debug 是徒劳的。
然后执行命令:

svn propset svn:global-ignores -F .svnignore .

In subversion 1.8 over, it is possible to set global-ignores for current repository.

svn propset svn:global-ignores build .
svn propset svn:global-ignores dist .

Also you can create a folder named .svnignore, and write conditions.

build
dist

remember one condition per line, setting build/* or dist/debug is in vain.
Then do the command:

svn propset svn:global-ignores -F .svnignore .
月依秋水 2024-08-24 07:04:48

例如文件夹结构:

Project/
Project/dist/

cd Project
svn propset svn:ignore '*' dist/
svn ci -m "content of dist ignored"

最好在忽略命令之前对 dist 内容执行 svn delete,这样对于分支 dist 将为空。

为我工作,今天测试。
这是解释它的页面一点

For example the folder structure:

Project/
Project/dist/

cd Project
svn propset svn:ignore '*' dist/
svn ci -m "content of dist ignored"

It's good to do a svn delete of dist content before the ignore command, so for branches dist will be empty.

Worked for me, tested today.
Here is the page explaining it a bit

飘落散花 2024-08-24 07:04:48

为了忽略所有存储库中的所有此类文件,您可以将 global-ignores 添加到每个用户的配置文件中。

在类 Unix 系统上,该区域
显示为名为的目录
用户家中的.subversion
目录。在 Win32 系统上,
Subversion 创建一个名为
颠覆,通常是在内部
用户的应用程序数据区域
个人资料目录

请参阅配置选项

不幸的是,没有针对每个存储库的选项来执行此操作。它基本上是针对每个用户或每个目录的,因此多个 svn:ignores 可能是可行的方法,尽管它可能很烦人。

In order to ignore all such files in all repositories, you could add a global-ignores to your per-user configuration file.

On Unix-like systems, this area
appears as a directory named
.subversion in the user's home
directory. On Win32 systems,
Subversion creates a folder named
Subversion, typically inside the
Application Data area of the user's
profile directory

See Configuration Options

Unfortunately, there's no per-repository option to do this. It's basically per-user, or per-directory, so the multiple svn:ignores is probably the way to go, as annoying as it can be.

小姐丶请自重 2024-08-24 07:04:48

您首先必须移动到工作副本的顶部文件夹并在那里创建一个文件(例如 .svnignore),您应该在其中放置您想要忽略的所有模式,例如(对于 Android 项目):

bin
gen
proguard
.classpath
.project
local.properties
Thumbs.db
*.apk
*.ap_
*.class
*.dex

然后运行以下命令(请记住,您必须位于工作副本的顶层文件夹):

svn propset svn:ignore -R -F .svnignore .

这仅适用于尚未受版本控制的文件夹和文件。如果您希望正在版本控制的文件夹(或文件)也开始被忽略,请通过运行以下命令将其从版本控制中删除:

svn rm --keep-local <path>

从这篇解释这一切的精彩文章中获取所有这些:http://superchlorine.com/2013/08/getting-svn-to-ignore-文件和目录/

You first have to move to the top folder of your working copy and create a file there (say .svnignore) where you should place all the patterns that you want to be ignored, for example (for an Android project):

bin
gen
proguard
.classpath
.project
local.properties
Thumbs.db
*.apk
*.ap_
*.class
*.dex

Then you run the following command (remember that you must be at the top folder of your working copy):

svn propset svn:ignore -R -F .svnignore .

This will only work for folders and files that are not yet under version control. If you want a folder (or file) that is being versioned to start being ignored as well, remove it from version control by running the command:

svn rm --keep-local <path>

Got all this from this great article that explains it all: http://superchlorine.com/2013/08/getting-svn-to-ignore-files-and-directories/

瑾兮 2024-08-24 07:04:48

创建一个文件并将您的忽略添加到其中

inore-list:

file1 
directory1
file2
etc...

然后应用以下命令

for n in directory; do svn propset svn:ignore -F ignore-list $n; done

目录是您的目录的名称,您也可以对目录/子目录进行子分类。或者使用 * 来记下您所在的当前目录。

这是假设您使用 bash 作为 shell

Create a file and add your ignores into it

ingore-list:

file1 
directory1
file2
etc...

then apply the following command

for n in directory; do svn propset svn:ignore -F ignore-list $n; done

directory is name of your directory, you can sub categorize as well directory/sub-directory. Or use * to note current directory you are under.

This is assuming you are using bash as your shell

千纸鹤带着心事 2024-08-24 07:04:48
svn propset --recursive svn:ignore svn_ignore_rules .

其中 svn_ignore_rules 是一个包含忽略规则的文件 - 每行一个

当然,每次向存储库添加新目录时都必须重新运行它

svn_ignore_rules 也可以被视为签入存储库,以便可重复使用由对存储库具有写入权限的其他用户执行

svn propset --recursive svn:ignore svn_ignore_rules .

where svn_ignore_rules is a file containing the ignore rules -- one per line

Of course you have to re-run it every time you add a new directory to your repo

svn_ignore_rules can also be considered to be checked into the repo, to be re-useable by other users having write access to the repo

行雁书 2024-08-24 07:04:48
cd parent_dir #the directory containing folder to be ignored recursively
svn propedit svn:ignore . #will open up svn-prop.tmp
enlist folder(s)
^X
Y
commit -m 'ignore targeted direcoty'
cd parent_dir #the directory containing folder to be ignored recursively
svn propedit svn:ignore . #will open up svn-prop.tmp
enlist folder(s)
^X
Y
commit -m 'ignore targeted direcoty'
回忆凄美了谁 2024-08-24 07:04:48

一种方法是向提交前或提交后挂钩添加某种检查,但如果您不拥有存储库服务器,则需要直接注意。

One way would be to add some kind of check to either the pre- or post- commit hook but it's note straight forward if you don't own the repo server.

病毒体 2024-08-24 07:04:48

由于这个可能常见的问题似乎没有解决方案,我想分享我们的解决方案。正如其他人已经明确指出的那样,您可以使用 svn:ignore 属性,这适用于单个目录(因此不适用于新目录),或者使用 global-ignores code> 适用于单个用户(但不属于存储库)。

为了让生活更轻松一些,我创建了一个名为 Settings.Svn.reg 的 reg 文件,并将其添加到存储库的根目录中。现在每个人都可以双击这个regfile一次,并完成设置。

REGEDIT4

[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\miscellany]
"global-ignores"="obj *.suo *.bak *.pdb *.user *.Cache*"

我真的很感激 SVN 存储库中的解决方案,所以如果有人知道,您愿意分享吗?

Since there seems to be no solution for this probably common problem, i would like to share our solution. As the others already made clear, you can either use the svn:ignore property, this applies to a single directory (and therefore not for new ones), or you use global-ignores which applies to a single user (but doesn't belong to the repository).

To make life a bit easier i created a reg file named Settings.Svn.reg and added it to the root of the repository. Now everybody can doublecklick this regfile once, and has the settings done.

REGEDIT4

[HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config\miscellany]
"global-ignores"="obj *.suo *.bak *.pdb *.user *.Cache*"

I would really appreciate a solution within the SVN repository, so if somebody knows, would you care to share it?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文