简体   繁体   English

如何从 mercurial 中的历史记录中删除大文件?

[英]How do you remove big files from history in mercurial?

I have just created a mercurial repo created from a heterogeneous ecosystems of other repos.我刚刚创建了一个 mercurial 回购协议,该回购协议是从其他回购协议的异构生态系统中创建的。 Before I publish it to my co-workers, I want to clean it as much as possible.在我将它发布给我的同事之前,我想尽可能地清理它。 To this end, I'd like to entirely remove a few big old files from history (pretend they never existed), so repo will be smaller.为此,我想从历史记录中完全删除一些大的旧文件(假装它们从未存在过),这样 repo 就会更小。

Is this possible with mercurial? mercurial 这可能吗?

Check out the convert extension, particularly the --filemap option.检查convert扩展,特别是--filemap选项。

Enable by adding the following to mercurial.ini :通过将以下内容添加到mercurial.ini来启用:

[extensions]
convert =

Create a map of files to exclude:创建 map 个要排除的文件:

exclude path/to/file1
exclude path/to/file2

Then convert the repo:然后转换回购:

hg convert srcrepo destrepo --filemap <map>

Note there is a bug in Mercurial 2.1.1 causing an error with the above command:请注意,Mercurial 2.1.1 中存在一个错误,导致上述命令出错:

initializing destination destrepo repository
abort: invalid mode ('r') or filename

Just add the --splicemap <nonexistent file> option to fix the problem.只需添加--splicemap <nonexistent file>选项即可解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM