从 svn 存储库中删除包含所有历史记录的文件 [英] Delete file with all history from svn repository

查看:77
本文介绍了从 svn 存储库中删除包含所有历史记录的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从 svn 存储库中删除文件,包括其所有历史记录?当我想摆脱驻留在 repo 中的大型二进制文件时,就会出现这个问题.

Is there any way to delete file from svn repository including all its history? This issue emerges when I want to get rid of large binary file residing in repo.

我只知道一种方法可能对这种情况有所帮助:

I know only one approach that might help in this situation:

  1. svnadmin 实用程序的帮助下转储所有存储库.
  2. 使用 grep 过滤转储文件.Grep 应该使用文件名并写入另一个转储文件
  3. 使用 svnadmin
  4. 导入最后一个转储文件
  1. Dump all repo with the help of svnadmin utility.
  2. Filter dumped file with grep. Grep should use filename and write in to the other dump-file
  3. Import last dump-file with svnadmin

但这太复杂且不可靠.也许还有其他解决方案?

But this is too complicated and unreliable. Maybe there is another solution?

推荐答案

最近使用 svndumpfilter 命令变得更加简单.Subversion 文档中提供了详细信息 此处.基本上,为了避免冲突(在 here 中解释),它需要一个 repo 转储并重做每个提交,包括或排除给定的文件前缀.基本语法:

This has recently become much more straightforward with the command svndumpfilter. Details are available in the subversion documentation here. Basically, to avoid conflicts (explained here), it takes a repo dump and redoes each commit, either including or excluding a given file prefix. Basic syntax:

svndumpfilter exclude yourfileprefix < yourdump > yournewdump

排除可能是提问者正在寻找的内容,但您也可以使用 include 来提取存储库的子树,以便将其作为自己的存储库分离出来.

Exclude is probably what the question asker is looking for, but you can also use include to, say, extract a subtree of the repo so as to spin it off as its own repository.

subversion 中最新版本的 subversion(非常元)也可以采用 glob 模式.我最近不得不从 repo 中删除所有 pdf,而且很容易做到:

The latest revision of subversion in subversion (very meta) can also take glob patterns. I recently had to remove all pdfs from a repo and it was very easily done like so:

svndumpfilter exclude --pattern '*.pdf' < dump > dump_nopdfs

进一步的使用信息可以通过调用svndumpfilter helpsvndumpfilter help exclude找到.

Further usage information can be found by calling svndumpfilter help and svndumpfilter help exclude.

这篇关于从 svn 存储库中删除包含所有历史记录的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆