如何清理Mercurial存储库? [英] How to cleanup Mercurial repository?

查看:75
本文介绍了如何清理Mercurial存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从存储库中删除所有历史记录的上载"文件夹,因为它仅包含垃圾测试数据.

I need to delete my "uploads" folder from the repository with all its history because it contains only junk testing data.

请帮助.

推荐答案

您将要使用 convert 附带了Mercury的扩展程序.由于要从历史记录中清除目录,因此必须完全过滤现有的存储库,因此请将其转换为新的存储库.

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:

/
 src
 doc
 images
 upload

使用以下内容创建一个简单的文本文件

Create a simple text file with the following content

exclude upload

您可以使用此文件做更多的事情,但要使其简单易行即可达到目标.要排除的路径是相对于存储库根的

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

现在运行水银转换

hg convert --filemap path/to/the/textfile old-repo new-repo

切换到新仓库的目录.请注意,mercurial创建了一个裸/空的re repo(除了.hg目录之外没有其他内容).运行以下命令以更新到最新的changset.注意上传目录不见了!

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!

cd path/to/new/repo
hg update

警告:我不知道它如何处理命名的分支或标记.你一个人.至少您没有修改原始存储库.制作所需数量的副本以使其正确无误.

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.

这篇关于如何清理Mercurial存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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