SVN Revert Trunk,删除修订版本,就好像它从未存在过一样?

发布于 2024-12-01 22:22:05 字数 304 浏览 1 评论 0原文

是否可以在 svn 服务器中删除修订版,就好像它从未存在过一样?

所以我们有以下修改:

1004 // Commit of some bogus code that broke the build and was just wrong
1003 // Change 1.2
1002 // Change 1.1
1001
1000 *** Initial checkin

我们可以删除svn中的1004并恢复到1003,就好像1004从未存在过一样吗?

原谅我的无知,我还在学习如何使用SVN。

Is it possible in the svn server to remove a revision as if it never existed?

So we have the following revisions:

1004 // Commit of some bogus code that broke the build and was just wrong
1003 // Change 1.2
1002 // Change 1.1
1001
1000 *** Initial checkin

Can we we remove the 1004 in svn and revert back to 1003 as if 1004 never existed?

Forgive my ignorance, I'm still learning how to use SVN.

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

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

发布评论

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

评论(5

梦归所梦 2024-12-08 22:22:05

这些事故时有发生,如果 SVN 将它们保留在历史记录中,那就不是问题了。重要的是修复事故。执行此操作的方法是恢复此提交所做的更改。使用以下命令:

svn merge -r [current_version]:[previous_version] [repository_url]
svn commit -m “Reverting previous commit and going back to revision [previous_version].”

如果您使用 TortoiseSVN,您可以只显示日志,选择提交,然后在上下文菜单中选择“恢复此版本的更改”。它将把您的工作副本更改为以前的版本,您只需提交即可。

我想其他图形客户端也有相同的选项。

These accidents hapen, and it's not a problem if SVN keeps them in its history. What is important is to fix the accident. The way to do it is to revert the changes made by this commit. use the following commands:

svn merge -r [current_version]:[previous_version] [repository_url]
svn commit -m “Reverting previous commit and going back to revision [previous_version].”

If you're using TortoiseSVN, you could just show the logs, select the commit, and choose "Revert changes from this revision" in the context menu. It will change your working copy to the previous version, and you'll just have to commit.

I guess other graphical clients have the same option.

若沐 2024-12-08 22:22:05

VCS 系统经过专门设计,使这一过程尽可能复杂。您通常不想这样做。

话虽如此,从官方文档来看:

在某些特殊情况下,您可能希望销毁文件或提交的所有证据。 (也许有人不小心泄露了一份机密文档。)这并不那么容易,因为 Subversion 被故意设计为永远不会丢失信息。修订版是一棵不可变的树,相互构建。从历史记录中删除修订会导致多米诺骨牌效应,在所有后续修订中造成混乱,并可能使所有工作副本失效。

但是,该项目计划有一天实现一个 svnadmin obliterate 命令,该命令将完成永久删除信息的任务。 (请参阅问题 516。)

与此同时,您唯一的办法是svnadmin转储您的存储库,然后通过svndumpfilter(排除错误路径)将转储文件传输到svnadmin负载中 命令。有关详细信息,请参阅 Subversion 书籍的第 5 章。< /p>

http://subversion.apache.org/faq.html#removal

VCS systems are designed specifically to make this as complicated as possible. You usually do not want to do this.

That being said, from the official documentation:

There are special cases where you might want to destroy all evidence of a file or commit. (Perhaps somebody accidentally committed a confidential document.) This isn't so easy, because Subversion is deliberately designed to never lose information. Revisions are immutable trees which build upon one another. Removing a revision from history would cause a domino effect, creating chaos in all subsequent revisions and possibly invalidating all working copies.

The project has plans, however, to someday implement an svnadmin obliterate command which would accomplish the task of permanently deleting information. (See issue 516.)

In the meantime, your only recourse is to svnadmin dump your repository, then pipe the dumpfile through svndumpfilter (excluding the bad path) into an svnadmin load command. See chapter 5 of the Subversion book for details about this.

http://subversion.apache.org/faq.html#removal

风柔一江水 2024-12-08 22:22:05

您可以将主干移动到另一个分支(备份)并将正确的修订版本复制回主干

svn mv trunk https://svn_path/tags/trunk_broken
svn cp -r revNo http://svn_path/tags/trunk_broken http://svn_path/trunk

请注意,修订版本号将增加,并且所有更改都将显示在 svn 日志中。

You can move the trunk to another branch (backup) and copy the correct revision back to trunk

svn mv trunk https://svn_path/tags/trunk_broken
svn cp -r revNo http://svn_path/tags/trunk_broken http://svn_path/trunk

Please note the revision number will increment and all changes will be displayed in svn log.

一杆小烟枪 2024-12-08 22:22:05

您可以创建当前存储库的转储并跳过转储中的虚假修订。然后,您可以将转储加载到同一服务器或不同服务器上的新存储库。

You can create a dump of the current repository and skip the bogus Revision in the dump. You can then load the dump to a new repository on the same server or on a different one.

夏の忆 2024-12-08 22:22:05

如果您没有真正的理由(例如空间不足)删除它,我建议您保留该修订版。这是 SVN 服务器的主要工作,保存更改。

I recommend leaving the revision if you don't have a real reason (Shortage in space for example) to remove it. This is the main job of the SVN server, to keeps changes.

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