如何删除SVN-repository中的目录并同时将其设置为svn:ignore?

发布于 2024-07-30 20:59:56 字数 149 浏览 14 评论 0原文

我想通过命令行删除存储库中的目录。 同时,我不想将 Subversion 将此更改传播到本地工作副本。

工作副本中的目录应保持原样不变(唉,我想设置 svn:ignore 属性)。 不管怎样,如果不将删除传播到我的工作副本,我无法找到一种方法来完成此任务。

I want to delete a directory in the repository via command line. At the same time, I don't want to propagate Subversion this change to the local working copy.

The directory in the working copy should be remained untouched as it is (alas, I want to set svn:ignore property). Anyway, I couldn't figure out a way to accomplish this without the deletes being propagated to my working copy.

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

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

发布评论

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

评论(3

入怼 2024-08-06 20:59:59

这是另一个问题的被盗答案(谢谢 Maciej Łebkowski!):

根据我的经验:不要将该文件置于版本控制之下并使用 svn:ignore在上面。

一开始有点困难,因为您无法忽略已在版本控制下的文件,并且您无法从版本控制中删除文件而不将其从硬盘驱动器(以及下次更新时的每个工作副本中删除)。 .). 但是,当您最终成功地正确设置存储库时,它就像魅力一样。 不要忘记添加通用模板来代替原始配置文件(以便每个人都知道新的配置变量等)。

对于新仓库:

mkdir config
svn 添加配置
svn propset svn:ignore '*.conf' config

对于现有的存储库:请确保在每个工作副本中备份您的配置,然后从存储库中删除 (svn del) 配置,提交(请注意:文件将在下次更新时在每个工作副本中删除!您必须有备份),然后恢复文件并设置忽略属性。

另一种方法是锁。 它保证没有人提交该文件,但每次提交都会导致错误。 不大好。

第三种方式 - 变更集,SVN 1.5 客户端中的一个新功能。 这很简洁,但它只与一个工作副本相关,而不与全局存储库相关。 而且您必须手动设置它们,添加每个新文件 - 这很难维护。

Here a stolen answer to another question (thanks Maciej Łebkowski!):

From my experience: don`t put that file under version control and use svn:ignore on it.

It’s a little hard at the beginning, since you cannot ignore a file that is allready under version control, and you cannot remove a file from version control without removing it from hard drive (and from every working copy on next update...). But when you finally manage to set up the repo correctly, it works like charm. Don’t forget to add a generic-template in place of your original config file (so that everyone knows about new config variables, and so on).

For new repo:

mkdir config
svn add config
svn propset svn:ignore '*.conf' config

For existing repo: be sure, to have a backup of your config in every working copy, then remove (svn del) config from the repo, commit (please note: the file will be deleted in every working copy on next update! you have to have a backup) and then restore the file and set the ignore property.

Another way is a lock. It guarantees that noone commits the file, but it will result in an error on every commit. not very nice.

And the third way - changesets, a new feature in SVN 1.5 clients. This is neat, but it’s only related to one working copy, not to a repository globally. And you have to set them up manually, add every new file — it’s hard to maintain.

掩耳倾听 2024-08-06 20:59:58

就像Thorarin 说,这似乎不可能,因为无论 svn:ignore 属性如何,删除命令都会传播。

更安全的迁移可能是重命名有问题的目录(例如 dir.old,然后在原始目录名称上添加 svn:ignore),而不是删除。然后您可以告诉人们手动复制他们的目录目录恢复为原始名称,然后

根据此目录中的文件类型,您可能还希望永久保留它,作为开发人员同步其更改的地方。在这种情况下,您可以将其保留。通过将其称为 dir.tmpl 之类的名称来明确它是一个模板目录,这样就不会直接使用它。

Like Thorarin said, it doesn't seem possible, since the delete command would get propagated regardless of the svn:ignore property.

Instead of deleting, a safer migration might be to rename the problematic directory (to something like dir.old, and then add svn:ignore on the original directory name. You could then tell people to manually copy their directory back to the original name, before you completely delete it.

Depending on the kind of files in this directory, you might also want to keep it around permanently, as a place for developers to synchronize their changes. In this case you can make it clear that it is a template directory by calling it something like dir.tmpl, so that it does not get used directly.

暮倦 2024-08-06 20:59:58

据我所知,这是不可能的。 一旦文件真正被版本化,svn:ignore 将不会执行任何操作。

这使得做这样的事情有些危险,因为人们可能有他们想要保留的本地更改。 如果他们不注意,他们可能会失去它们。

As far as I know, this is impossible. svn:ignore won't do anything once files are actually being versioned.

It makes something like this somewhat dangerous to do, as people might have local changes they want to keep. If they're not paying attention, they could lose them.

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