Mercurial 永久删除?
我提交了一些 3rd 方工具,后来我决定不再使用它们,并再次从 hg 中删除它们。
我不喜欢的事情 - 它们仍然保留在历史中。通常这当然是一件好事,但对于这种特殊情况 - 这只是浪费空间。
有哪些选项可以故意弄乱 hg 存储库历史并将其清除?
I commit some 3rd party tools that i decided not to use afterwards and removed them from hg again.
Thing that i dislike - they are still kept in history. Normally this is a good thing of course, but for this particular case - that's just a waste of space.
What are options to intentionally mess around with hg repository history and weed it out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不介意切换到新的存储库,那么最好的选择是使用转换扩展。
您可以传递一个文件映射来排除您想要排除的任何文件,它将为您创建一个新的存储库,而不引用您的文件。当然,这意味着必须克隆一个新的工作副本。
这意味着存储库的每个工作副本,因此如果周围有很多工作副本,请做好做大量工作的准备。
If you don't mind having to switch to a new repository, your best bet would be to use the convert extension.
You can pass a filemap that excludes any files that you want to exclude and it will create a new repository for you, without any references to your files. Of course, this means having to clone a new working copy.
This means every working copy for the repository, so if there are a lot of working copies around, be prepared to do a lot of work.
激活 Mercurial 队列扩展并使用“hg strip”重写历史记录。如果您有任何克隆,请推送它们的更改并销毁它们,执行“hg strip”并再次克隆。
如果存在你无法控制的克隆,那么所有的赌注都会失败。我将使用“convert”扩展来重建存储库,执行“hg strip”,并替换旧的存储库。旧克隆在尝试推/拉时会收到错误,因为新存储库具有不同的 UUID,因此用户会知道他们必须再次销毁+克隆。
Activate the mercurial queue extension and use "hg strip" to rewrite history. If you have any clone out there, push their changes and destroy them, do the "hg strip" and clone again.
If there are clones out there you can not control, all the bets are off. I would use the "convert" extension to rebuild the repository, do the "hg strip", and replace the old repository. Old clones will get an error when trying to push/pull, because the new repository has a different UUID, so the users will know they must destroy+clone again.