如何清理 Mercurial 存储库?
我需要从存储库中删除“上传”文件夹及其所有历史记录,因为它只包含垃圾测试数据。
请帮忙。
I need to delete my "uploads" folder from the repository with all its history because it contains only junk testing data.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用 Mercurial 附带的 convert 扩展程序。由于您想从历史记录中清除目录,因此您必须完全过滤现有存储库,将其转换为新存储库。
假设您的存储库的结构如下:
创建一个包含以下内容的简单文本文件
您可以使用此文件执行更多操作,但要保持简单以实现您的目标。要排除的路径是相对于存储库根的路径
现在运行 Mercurial Convert
更改到新存储库的目录。请注意,mercurial 创建了一个 bare/null rev 存储库(除了 .hg 目录之外没有任何内容)。运行以下命令以更新到最新的更改集。请注意,上传目录消失了!
警告:我不知道它如何处理命名分支或标签。你只能靠你自己了。至少您没有修改原始存储库。根据需要制作尽可能多的副本以确保正确。
You'll want to use the convert extension that ships with mercurial. Since you want to scrub a directory from the history you'll have to completely filter you're existing repository, CONVERTing it into a new one.
Assume the following made up structure of your repo:
Create a simple text file with the following content
You can do more with this file but keep it simple to get to your goal. The path to be excluded is relative to the repository root
Now run mercurial convert
Change to the directory of the new repo. Notice that mercurial created a bare/null rev repo (no content but the .hg directory). Run the following to update to your latest changset. Notice the upload directory is gone!
WARNING: I do not know how this handles named branches or tags. You're on your own. At least you're not modifying the original repo. Make as many copies as you need to get it right.