如何从特定的Mercurial克隆中删除某些变更集? [英] How to remove certain changesets from a specific Mercurial clone?

查看:85
本文介绍了如何从特定的Mercurial克隆中删除某些变更集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个中央仓库的副本,版本为2048.我想删除本地仓库中的最后10个变更集,就像我回到了两周前的时间一样.我想我可以删除本地存储库并执行"hg clone -rev 2038",但这会很长(克隆存储库需要几分钟).有没有办法只是拉"一些变更集?

I have a clone of a central repo at rev 2048. I want to remove the last 10 changesets on my local repo as if I was back in time two weeks ago. I suppose I could delete my local repo and do "hg clone -rev 2038" but that would be long (cloning the repo takes several minutes). Is there a way to just "unpull" some changesets?

注意:

  • 我不是要撤消变更集.我最终将再次从中央存储库中提取这些变更集.
  • 我不尝试将工作目录更新为较早的版本;我真的很想影响存储库.
  • 我的当前存储库和工作目录中没有任何传出的变更集或挂起的修改.

推荐答案

使用strip命令:

hg strip -r 2039

此命令由 StripExtension 提供.它作为Mercurial 2.8和更高版本的一部分分发,但是您确实需要首先通过在.hgrc或Mercurial.ini中添加以下行来启用它:

This command is provided by the StripExtension. It is distributed as part of Mercurial 2.8 and later, but you do need to enable it first by adding the following lines to your .hgrc or Mercurial.ini:

[extensions]
strip =

在Mercurial 2.8之前,它是 MqExtension 的一部分.

Before Mercurial 2.8, it was part of the MqExtension.

为防止意外破坏历史记录,该命令将在.hg/strip-backup/中生成一个备份包,如果需要,您可以再次hg unbundle.

To prevent you from accidentally destroying history, the command will generate a backup bundle in .hg/strip-backup/ which you can hg unbundle again if desired.

这篇关于如何从特定的Mercurial克隆中删除某些变更集?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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