Mercurial 删除变更集、合并历史记录
我想从历史记录中删除变更集,但hg export
不适用于合并变更集(请参阅 https://www.mercurial-scm.org/wiki/Export)。有没有办法使用 hg pull
进行一系列修订?例如,假设我想删除修订版 999,我希望能够说:
hg init NewRepo
hg pull ../OldRepo -r 0:1000
hg pull ../OldRepo -r 1000:tip
有什么想法吗?
I want to remove a changeset from history but hg export
does not work for merge changesets (see https://www.mercurial-scm.org/wiki/Export). Is there a way to use hg pull
for a range of revisions? For example, say I want to remove revision 999 I want to be able to say:
hg init NewRepo
hg pull ../OldRepo -r 0:1000
hg pull ../OldRepo -r 1000:tip
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Pull 无法拉取一系列修订,因为存储库中存在的每个 Mercurial 修订都必须在该修订中包含其所有祖先变更集。因此,如果您这样做:
您也会获得修订版 1000 的所有祖先修订版。
一般来说,Mercurial 是关于建立一个不可变的历史——如果你对一个变更集感到遗憾,你不会删除它,而是创建一个新的变更集来撤消你不再喜欢的变更集的工作。如果您无法在存储库中保留完整的历史记录,则需要使用
strip
或convert
扩展程序。两者都像宣传的那样工作,但也提供了很多搬起石头砸自己脚的机会。如果您能忍受,只需撤消后续变更集中的繁重变更集并继续。Pull can't pull a range of revisions because every mercurial revision that exists in a repository must have all of its ancestor changesets in that revision too. So if you do:
you get all of revision 1000's ancestor revisions too.
In general, mercurial is about building an immutable history -- if you regret a changeset you don't remove it you create a new one that undoes the work of the changeset you no longer like. If you can't abide having full history in your repo you need to use something like the
strip
orconvert
extension. Both work as advertised, but provide plenty of opportunities to shoot yourself in the foot. If you can stand it, just undo the onerous changeset in a subsequent changeset and move on.