如何修剪Subversion中的旧版本?

时间:2022-01-29 07:11:34

How can I prune old revisions from my development subversion repository? I keep a subversion sandbox in which I have lots of test projects, binaries, etc. I'd like to prune the history occasionally.

如何从我的开发subversion存储库中删除旧版本?我保留了一个颠覆沙箱,其中我有很多测试项目,二进制文件等。我想偶尔修剪历史。

4 个解决方案

#1


27  

Here's the official answer:

这是官方的答案:

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.

在某些特殊情况下,您可能希望销毁文件或提交的所有证据。 (也许有人意外地提交了一份机密文件。)这并不容易,因为Subversion是故意设计的,永远不会丢失信息。修订是不可变的树,彼此建立在一起。从历史记录中删除修订版会导致多米诺骨牌效应,在所有后续修订版中产生混乱,并可能使所有工作副本无效。

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

然而,该项目计划有一天实施一个svnadmin obliterate命令,该命令将完成永久删除信息的任务。 (见问题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.

与此同时,您唯一的办法是svnadmin转储您的存储库,然后通过svndumpfilter(不包括坏路径)将dumpfile传输到svnadmin load命令中。有关详细信息,请参阅Subversion书的第5章。

Found here: http://subversion.tigris.org/faq.html#removal

在这里找到:http://subversion.tigris.org/faq.html#removal

#2


5  

Jon - we disagree. There are times when it's appropriate to prune "very old" data that we are certain will no longer be needed because it is backed up in some other media. Take for example, a system that tracks versions of configuration files automatically. At some point, it makes sense to say - "We know that we no longer need to have the configuration the way it looked a year ago to be on-line. Having that information in some off-line format is fine, but leaving it on-line in the production systems is not a good thing." That is the perfect example of when it's appropriate to be able to easily archive the very old data, then prune it from the repository. I've found a way around the problem, but I think it is a real hack that I have to effectively re-play history from a certain point in time through all the revisions to create a new repository so I can replace the old one.

乔恩 - 我们不同意。有时候修剪“非常旧”的数据是合适的,我们确定不再需要这些数据,因为它在其他一些媒体上备份。例如,一个自动跟踪配置文件版本的系统。在某些时候,有意义地说 - “我们知道我们不再需要按照一年前的方式进行配置才能上线。以某种离线格式提供这些信息很好,但是留下它生产系统中的在线并不是一件好事。“这是能够轻松存档旧数据,然后从存储库中删除它的适当时机的完美示例。我找到了解决这个问题的方法,但我认为这是一个真正的黑客,我必须从某个时间点通过所有修订版有效地重新创建历史记录以创建新的存储库,以便我可以替换旧的存储库。

#3


4  

You can use svndumpfilter.

你可以使用svndumpfilter。

However it's really not a recommended thing to do. Repositories are supposed to be (mostly) append-only databases. Some amount of data mutation is tolerable thanks to the centralized nature of the database, but it's not supposed to be routine operation.

然而,它确实不是一个推荐的事情。存储库应该(大多数情况下)仅附加数据库。由于数据库的集中性,一些数据突变是可以容忍的,但它不应该是常规操作。

You should probably use a separate repository for each project instead of one bag repository that you will want to prune from time to time.

您可能应该为每个项目使用单独的存储库,而不是一个您想要不时修剪的行包存储库。

#4


2  

You don't really want to prune the history, that way lies madness.

你真的不想修剪历史,那种方式就是疯狂。

You may want to delete old branches so that they don't appear in your svn browser, but that's just as straightforward as an 'svn rm'. The revisions remain in the version control system.

您可能希望删除旧分支,以便它们不会出现在您的svn浏览器中,但这与'svn rm'一样简单。修订版仍保留在版本控制系统中。

#1


27  

Here's the official answer:

这是官方的答案:

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.

在某些特殊情况下,您可能希望销毁文件或提交的所有证据。 (也许有人意外地提交了一份机密文件。)这并不容易,因为Subversion是故意设计的,永远不会丢失信息。修订是不可变的树,彼此建立在一起。从历史记录中删除修订版会导致多米诺骨牌效应,在所有后续修订版中产生混乱,并可能使所有工作副本无效。

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

然而,该项目计划有一天实施一个svnadmin obliterate命令,该命令将完成永久删除信息的任务。 (见问题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.

与此同时,您唯一的办法是svnadmin转储您的存储库,然后通过svndumpfilter(不包括坏路径)将dumpfile传输到svnadmin load命令中。有关详细信息,请参阅Subversion书的第5章。

Found here: http://subversion.tigris.org/faq.html#removal

在这里找到:http://subversion.tigris.org/faq.html#removal

#2


5  

Jon - we disagree. There are times when it's appropriate to prune "very old" data that we are certain will no longer be needed because it is backed up in some other media. Take for example, a system that tracks versions of configuration files automatically. At some point, it makes sense to say - "We know that we no longer need to have the configuration the way it looked a year ago to be on-line. Having that information in some off-line format is fine, but leaving it on-line in the production systems is not a good thing." That is the perfect example of when it's appropriate to be able to easily archive the very old data, then prune it from the repository. I've found a way around the problem, but I think it is a real hack that I have to effectively re-play history from a certain point in time through all the revisions to create a new repository so I can replace the old one.

乔恩 - 我们不同意。有时候修剪“非常旧”的数据是合适的,我们确定不再需要这些数据,因为它在其他一些媒体上备份。例如,一个自动跟踪配置文件版本的系统。在某些时候,有意义地说 - “我们知道我们不再需要按照一年前的方式进行配置才能上线。以某种离线格式提供这些信息很好,但是留下它生产系统中的在线并不是一件好事。“这是能够轻松存档旧数据,然后从存储库中删除它的适当时机的完美示例。我找到了解决这个问题的方法,但我认为这是一个真正的黑客,我必须从某个时间点通过所有修订版有效地重新创建历史记录以创建新的存储库,以便我可以替换旧的存储库。

#3


4  

You can use svndumpfilter.

你可以使用svndumpfilter。

However it's really not a recommended thing to do. Repositories are supposed to be (mostly) append-only databases. Some amount of data mutation is tolerable thanks to the centralized nature of the database, but it's not supposed to be routine operation.

然而,它确实不是一个推荐的事情。存储库应该(大多数情况下)仅附加数据库。由于数据库的集中性,一些数据突变是可以容忍的,但它不应该是常规操作。

You should probably use a separate repository for each project instead of one bag repository that you will want to prune from time to time.

您可能应该为每个项目使用单独的存储库,而不是一个您想要不时修剪的行包存储库。

#4


2  

You don't really want to prune the history, that way lies madness.

你真的不想修剪历史,那种方式就是疯狂。

You may want to delete old branches so that they don't appear in your svn browser, but that's just as straightforward as an 'svn rm'. The revisions remain in the version control system.

您可能希望删除旧分支,以便它们不会出现在您的svn浏览器中,但这与'svn rm'一样简单。修订版仍保留在版本控制系统中。